Factory for creating MarshalByRefObject wrapper around target class.
Inheritance: Spring.Remoting.Support.ConfigurableLifetime, IInitializingObject, IFactoryObject
        public void CreateRemoteObject()
        {
            RemoteObjectFactory factory = new RemoteObjectFactory();
            factory.Target = new SimpleCounter();
            factory.AfterPropertiesSet();

            object obj = factory.GetObject();

            Assert.IsTrue((obj is MarshalByRefObject), "Object should derive from MarshalByRefObject.");
        }
        public void ReturnsInterfaceImplementation()
        {
            RemoteObjectFactory factory = new RemoteObjectFactory();
            factory.Target = new SimpleCounter();
            factory.AfterPropertiesSet();

            object obj = factory.GetObject();

            Assert.IsTrue((obj is ISimpleCounter), "Object should implement an interface.");
        }
        public void ReturnsInterfaceImplementation()
        {
            RemoteObjectFactory factory = new RemoteObjectFactory();

            factory.Target = new SimpleCounter();
            factory.AfterPropertiesSet();

            object obj = factory.GetObject();

            Assert.IsTrue((obj is ISimpleCounter), "Object should implement an interface.");
        }
        public void CreateRemoteObject()
        {
            RemoteObjectFactory factory = new RemoteObjectFactory();

            factory.Target = new SimpleCounter();
            factory.AfterPropertiesSet();

            object obj = factory.GetObject();

            Assert.IsTrue((obj is MarshalByRefObject), "Object should derive from MarshalByRefObject.");
        }
Esempio n. 5
0
            /// <summary>
            /// Create a new instance of the RemoteFactory.
            /// </summary>
            public CaoRemoteFactory(ILifetime lifetime, string targetName,
                                    string[] interfaces, AbstractObjectFactory objectFactory)
            {
                this.targetName    = targetName;
                this.objectFactory = objectFactory;

                this.remoteObjectFactory                    = new RemoteObjectFactory();
                this.remoteObjectFactory.BaseType           = typeof(BaseCao);
                this.remoteObjectFactory.Interfaces         = interfaces;
                this.remoteObjectFactory.Infinite           = lifetime.Infinite;
                this.remoteObjectFactory.InitialLeaseTime   = lifetime.InitialLeaseTime;
                this.remoteObjectFactory.RenewOnCallTime    = lifetime.RenewOnCallTime;
                this.remoteObjectFactory.SponsorshipTimeout = lifetime.SponsorshipTimeout;
            }
        public void CreateRemoteObjectWithLeaseInfo()
        {
            RemoteObjectFactory factory = new RemoteObjectFactory();
            factory.Target = new SimpleCounter();
            factory.Infinite = false;
            factory.InitialLeaseTime = TimeSpan.FromMilliseconds(10000);
            factory.RenewOnCallTime = TimeSpan.FromMilliseconds(1000);
            factory.SponsorshipTimeout = TimeSpan.FromMilliseconds(100);
            MarshalByRefObject remoteObject = (MarshalByRefObject) factory.GetObject();

            ILease lease = (ILease) remoteObject.InitializeLifetimeService();
            Assert.AreEqual(TimeSpan.FromMilliseconds(10000), lease.InitialLeaseTime, "InitialLeaseTime");
            Assert.AreEqual(TimeSpan.FromMilliseconds(1000), lease.RenewOnCallTime, "RenewOnCallTime");
            Assert.AreEqual(TimeSpan.FromMilliseconds(100), lease.SponsorshipTimeout, "SponsorshipTimeout");
        }
        public void CreateRemoteObjectWithLeaseInfo()
        {
            RemoteObjectFactory factory = new RemoteObjectFactory();

            factory.Target             = new SimpleCounter();
            factory.Infinite           = false;
            factory.InitialLeaseTime   = TimeSpan.FromMilliseconds(10000);
            factory.RenewOnCallTime    = TimeSpan.FromMilliseconds(1000);
            factory.SponsorshipTimeout = TimeSpan.FromMilliseconds(100);
            MarshalByRefObject remoteObject = (MarshalByRefObject)factory.GetObject();

            ILease lease = (ILease)remoteObject.InitializeLifetimeService();

            Assert.AreEqual(TimeSpan.FromMilliseconds(10000), lease.InitialLeaseTime, "InitialLeaseTime");
            Assert.AreEqual(TimeSpan.FromMilliseconds(1000), lease.RenewOnCallTime, "RenewOnCallTime");
            Assert.AreEqual(TimeSpan.FromMilliseconds(100), lease.SponsorshipTimeout, "SponsorshipTimeout");
        }
 public void BailsWhenNotConfigured()
 {
     RemoteObjectFactory factory = new RemoteObjectFactory();
     factory.AfterPropertiesSet();
 }
Esempio n. 9
0
			/// <summary>
			/// Create a new instance of the RemoteFactory.
			/// </summary>
            public CaoRemoteFactory(ILifetime lifetime, string targetName, 
                string[] interfaces, AbstractObjectFactory objectFactory)
			{
				this.targetName = targetName;
				this.objectFactory = objectFactory;

                this.remoteObjectFactory = new RemoteObjectFactory();
                this.remoteObjectFactory.BaseType = typeof(BaseCao);
                this.remoteObjectFactory.Interfaces = interfaces;
                this.remoteObjectFactory.Infinite = lifetime.Infinite;
                this.remoteObjectFactory.InitialLeaseTime = lifetime.InitialLeaseTime;
                this.remoteObjectFactory.RenewOnCallTime = lifetime.RenewOnCallTime;
                this.remoteObjectFactory.SponsorshipTimeout = lifetime.SponsorshipTimeout;
			}
        public void BailsWhenNotConfigured()
        {
            RemoteObjectFactory factory = new RemoteObjectFactory();

            Assert.Throws <ArgumentException>(() => factory.AfterPropertiesSet(), "The Target property is required.");
        }
 public void BailsWhenNotConfigured()
 {
     RemoteObjectFactory factory = new RemoteObjectFactory();
     Assert.Throws<ArgumentException>(() => factory.AfterPropertiesSet(), "The Target property is required.");
 }
        public void BailsWhenNotConfigured()
        {
            RemoteObjectFactory factory = new RemoteObjectFactory();

            factory.AfterPropertiesSet();
        }