/// <summary>
 /// Initializes a new instance of the <see cref="ServiceUrlBuilder"/> class.
 /// </summary>
 /// <param name="serviceType">Type of the service.</param>
 /// <param name="authenticationProvider">The authentication provider.</param>
 /// <param name="region">The region.</param>
 /// <param name="useInternalUrl">Specifies if internal URLs should be used.</param>
 public ServiceUrlBuilder(IServiceType serviceType, IAuthenticationProvider authenticationProvider, string region, bool useInternalUrl = false)
 {
     _serviceType = serviceType;
     _authenticationProvider = authenticationProvider;
     _region = region;
     _useInternalUrl = useInternalUrl;
 }
示例#2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ServiceUrlBuilder"/> class.
 /// </summary>
 /// <param name="serviceType">Type of the service.</param>
 /// <param name="authenticationProvider">The authentication provider.</param>
 /// <param name="region">The region.</param>
 /// <param name="useInternalUrl">Specifies if internal URLs should be used.</param>
 public ServiceUrlBuilder(IServiceType serviceType, IAuthenticationProvider authenticationProvider, string region, bool useInternalUrl = false)
 {
     _serviceType            = serviceType;
     _authenticationProvider = authenticationProvider;
     _region         = region;
     _useInternalUrl = useInternalUrl;
 }
示例#3
0
        public void Context()
        {
            _kernel = new StandardKernel();
            _kernel.Bind <IServiceType>().To <ServiceType>();
            var ninjectContainer = new NinjectContainer(_kernel);

            _result = ninjectContainer.Resolve <IServiceType>();
        }
        public override void Context()
        {
            base.Context();
            _serviceType = new ServiceType();
            WindsorContainer.Stub(x => x.Resolve<IServiceType>()).Return(_serviceType);

            _result = CastleContainer.Resolve<IServiceType>();
        }
示例#5
0
 /// <inheritdoc />
 protected override string LookupServiceTypeKey(IServiceType serviceType)
 {
     if (ServiceType.ContentDeliveryNetwork.Equals(serviceType))
     {
         return("hpext:cdn");
     }
     return(serviceType.Type);
 }
 public ServiceARequestController(IRequestService ServiceRequestImp, IService ServiceImp, IServiceType ServiceTypeImp, UserManager <CleaningUser> userManager, IDataProtectionProvider provider)
 {
     this.ServiceRequestImp = ServiceRequestImp;
     this.ServiceImp        = ServiceImp;
     this.ServiceTypeImp    = ServiceTypeImp;
     this.userManager       = userManager;
     this.protector         = provider.CreateProtector("protect_my_query_string");
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="ServiceEndpoint"/> class.
 /// </summary>
 /// <param name="serviceType">Type of the service.</param>
 /// <param name="authenticationProvider">The authentication provider.</param>
 /// <param name="region">The region.</param>
 /// <param name="useInternalUrl">Specifies if internal URLs should be used.</param>
 /// <param name="microversion">Specifies the microversion to send with each request.</param>
 /// <param name="microversionHeader">Specifies the header to use when setting the microversion.</param>
 public ServiceEndpoint(IServiceType serviceType, IAuthenticationProvider authenticationProvider, string region, bool useInternalUrl,
                        string microversion, string microversionHeader)
 {
     _serviceType            = serviceType;
     _authenticationProvider = authenticationProvider;
     Region              = region;
     UseInternalUrl      = useInternalUrl;
     _microversion       = microversion;
     _microversionHeader = microversionHeader;
 }
        /// <summary>
        /// Initializes a new instance of the <see cref="NetworkingService"/> class.
        /// </summary>
        /// <param name="serviceType">The service type for the desired networking provider.</param>
        /// <param name="authenticationProvider">The authentication provider.</param>
        /// <param name="region">The region.</param>
        public NetworkingApiBuilder(IServiceType serviceType, IAuthenticationProvider authenticationProvider, string region)
        {
            if(serviceType == null)
                throw new ArgumentNullException("serviceType");
            if (authenticationProvider == null)
                throw new ArgumentNullException("authenticationProvider");
            if (string.IsNullOrEmpty(region))
                throw new ArgumentException("region cannot be null or empty", "region");

            AuthenticationProvider = authenticationProvider;
            UrlBuilder = new ServiceUrlBuilder(serviceType, authenticationProvider, region);
        }
示例#9
0
        public void Polymorphic_ServiceType()
        {
            var          grainFullName = typeof(ServiceType).FullName;
            IServiceType serviceRef    = GrainClient.GrainFactory.GetGrain <IServiceType>(GetRandomGrainId(), grainFullName);

            Assert.AreEqual("A1", serviceRef.A1Method().Result);
            Assert.AreEqual("A2", serviceRef.A2Method().Result);
            Assert.AreEqual("A3", serviceRef.A3Method().Result);
            Assert.AreEqual("B1", serviceRef.B1Method().Result);
            Assert.AreEqual("B2", serviceRef.B2Method().Result);
            Assert.AreEqual("B3", serviceRef.B3Method().Result);
        }
示例#10
0
        public TimeOffDecorator(IServiceType aServiceType) : base(aServiceType)
        {
            //Name = "Time OFF";

            IServiceProperty props = new ServiceProperty {
                Name = "initialtimeoff", Type = "datetime", ServiceType = this
            };

            base.ServiceProperties.Add("initialtimeoff", props);
            props = new ServiceProperty {
                Name = "endtimeoff", Type = "datetime", ServiceType = this
            };
            base.ServiceProperties.Add("endtimeoff", props);
        }
        public void Context()
        {
            _windsorContainer = new WindsorContainer();

            _windsorContainer.Register(
                Component.For <IServiceType>()
                .ImplementedBy <ServiceType>()
                .LifeStyle.Transient
                );

            var castleContainer = new CastleContainer(_windsorContainer);

            _result = castleContainer.Resolve <IServiceType>();
        }
示例#12
0
        public DurationDecorator(IServiceType aServiceType) : base(aServiceType)
        {
            //base.Name = "Duration";

            IServiceProperty props = new ServiceProperty {
                Name = "initialdate", Type = "datetime", ServiceType = this
            };

            base.ServiceProperties.Add("initialdate", props);
            props = new ServiceProperty {
                Name = "enddate", Type = "datetime", ServiceType = this
            };
            base.ServiceProperties.Add("enddate", props);
        }
示例#13
0
        public void Polymorphic__DerivedServiceType()
        {
            var grainFullName = typeof(DerivedServiceType).FullName;
            IDerivedServiceType derivedRef = GrainClient.GrainFactory.GetGrain <IDerivedServiceType>(GetRandomGrainId(), grainFullName);

            IA IARef = derivedRef;

            Assert.AreEqual("A1", IARef.A1Method().Result);
            Assert.AreEqual("A2", IARef.A2Method().Result);
            Assert.AreEqual("A3", IARef.A3Method().Result);


            IB IBRef = (IB)IARef; // this could result in an invalid cast exception but it shoudn't because we have a priori knowledge that DerivedServiceType implements the interface

            Assert.AreEqual("B1", IBRef.B1Method().Result);
            Assert.AreEqual("B2", IBRef.B2Method().Result);
            Assert.AreEqual("B3", IBRef.B3Method().Result);

            IF IFRef = (IF)IBRef;

            Assert.AreEqual("F1", IFRef.F1Method().Result);
            Assert.AreEqual("F2", IFRef.F2Method().Result);
            Assert.AreEqual("F3", IFRef.F3Method().Result);

            IE IERef = (IE)IFRef;

            Assert.AreEqual("E1", IERef.E1Method().Result);
            Assert.AreEqual("E2", IERef.E2Method().Result);
            Assert.AreEqual("E3", IERef.E3Method().Result);

            IH IHRef = derivedRef;

            Assert.AreEqual("H1", IHRef.H1Method().Result);
            Assert.AreEqual("H2", IHRef.H2Method().Result);
            Assert.AreEqual("H3", IHRef.H3Method().Result);


            IServiceType serviceTypeRef = derivedRef; // upcast the pointer reference

            Assert.AreEqual("ServiceTypeMethod1", serviceTypeRef.ServiceTypeMethod1().Result);
            Assert.AreEqual("ServiceTypeMethod2", serviceTypeRef.ServiceTypeMethod2().Result);
            Assert.AreEqual("ServiceTypeMethod3", serviceTypeRef.ServiceTypeMethod3().Result);

            Assert.AreEqual("DerivedServiceTypeMethod1", derivedRef.DerivedServiceTypeMethod1().Result);
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="NetworkingApiBuilder"/> class.
        /// </summary>
        /// <param name="serviceType">The service type for the desired networking provider.</param>
        /// <param name="authenticationProvider">The authentication provider.</param>
        /// <param name="region">The region.</param>
        /// <param name="useInternalUrl">if set to <c>true</c> uses the internal URLs specified in the ServiceCatalog, otherwise the public URLs are used.</param>
        public NetworkingApiBuilder(IServiceType serviceType, IAuthenticationProvider authenticationProvider, string region, bool useInternalUrl)
        {
            if (serviceType == null)
            {
                throw new ArgumentNullException("serviceType");
            }
            if (authenticationProvider == null)
            {
                throw new ArgumentNullException("authenticationProvider");
            }
            if (string.IsNullOrEmpty(region))
            {
                throw new ArgumentException("region cannot be null or empty", "region");
            }

            AuthenticationProvider = authenticationProvider;
            Endpoint = new ServiceEndpoint(serviceType, authenticationProvider, region, useInternalUrl);
        }
        public void Context()
        {
            _setupContainerToResolveTheService();
            IoC.Initialize(new CastleContainer(_windsorContainer));
            _result = IoC.Resolve <IServiceType>();


            IoC.Release(_result);


            void _setupContainerToResolveTheService()
            {
                _windsorContainer = new WindsorContainer();

                _windsorContainer.Register(
                    Component.For <IServiceType>()
                    .ImplementedBy <ServiceType>()
                    .LifeStyle.Transient
                    );
            }
        }
示例#16
0
 /// <summary />
 public ComputeApi(IServiceType serviceType, IAuthenticationProvider authenticationProvider, string region, bool useInternalUrl)
     : this(serviceType, authenticationProvider, region, useInternalUrl, "2.2")
 { }
示例#17
0
 /// <summary />
 protected ComputeApi(IServiceType serviceType, IAuthenticationProvider authenticationProvider, string region, bool useInternalUrl, string microversion)
     : base(serviceType, authenticationProvider, region, useInternalUrl, microversion)
 { }
 /**
  * Constructor with parameters.
  *
  * @param Path    The path for the endpoint
  * @param Methods The methods for calling a path
  * @param Type    Protocol type.
  * @since V2.0.6
  */
 public ServicePath(string path, IServiceMethod[] methods, IServiceType type) : base()
 {
     this.Path    = Path;
     this.Methods = Methods;
     this.Type    = Type;
 }
 public ServiceTypeController(IServiceType ServiceTypeImp)
 {
     this.ServiceTypeImp = ServiceTypeImp;
 }
 /// <inheritdoc/>
 protected override string LookupServiceTypeKey(IServiceType serviceType)
 {
     return(serviceType.Type);
 }
示例#21
0
 protected DecoratorServiceType(IServiceType aServiceType)
 {
     _darthVader         = aServiceType;
     _mServices          = new List <IService>();
     _mServiceProperties = new Dictionary <string, IServiceProperty>();
 }
示例#22
0
 public ServiceTypesController(IServiceType service)
 {
     _service = service;
 }
 /// <inheritdoc/>
 protected override string LookupServiceTypeKey(IServiceType serviceType)
 {
     return serviceType.Type;
 }
示例#24
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ServiceEndpoint"/> class.
 /// </summary>
 /// <param name="serviceType">Type of the service.</param>
 /// <param name="authenticationProvider">The authentication provider.</param>
 /// <param name="region">The region.</param>
 /// <param name="useInternalUrl">Specifies if internal URLs should be used.</param>
 public ServiceEndpoint(IServiceType serviceType, IAuthenticationProvider authenticationProvider, string region, bool useInternalUrl)
     : this(serviceType, authenticationProvider, region, useInternalUrl, microversion : null, microversionHeader : null)
 {
 }
 /// <inheritdoc />
 protected override string LookupServiceTypeKey(IServiceType serviceType)
 {
     if (ServiceType.ContentDeliveryNetwork.Equals(serviceType))
         return "hpext:cdn";
     return serviceType.Type;
 }
 public ConfigureServiceController(IServiceConfig ConfigureService, IService ServiceImp, IServiceType ServiceTypeImp)
 {
     this.ConfigureService = ConfigureService;
     this.ServiceImp       = ServiceImp;
     this.ServiceTypeImp   = ServiceTypeImp;
 }
示例#27
0
 /// <inheritdoc />
 protected ComputeApi(IServiceType serviceType, IAuthenticationProvider authenticationProvider, string region, bool useInternalUrl, string microversion)
     : base(serviceType, authenticationProvider, region, useInternalUrl, microversion)
 {
 }
 /**
  * Sets the protocol for the path.
  *
  * @param Type Type of protocol.
  * @since V2.0.6
  */
 public void SetType(IServiceType Type)
 {
     this.Type = Type;
 }
示例#29
0
 /// <inheritdoc />
 public ComputeApi(IServiceType serviceType, IAuthenticationProvider authenticationProvider, string region, bool useInternalUrl)
     : this(serviceType, authenticationProvider, region, useInternalUrl, "2.6")
 {
 }
示例#30
0
 public void RequestService(IServiceType service)
 {
     this._service = service;
     ++_requestNumber;
     _totalPrice += _service.Price;
 }