상속: Spring.Threading.AsyncTestTask
        public static void CanAccessContextFromNonWebThreadImpl()
        {
            IApplicationContext ctx;

            ctx = WebApplicationContext.GetRootContext();

            AsyncTestMethod testMethod = new AsyncTestMethod(1, new AsyncTestMethod.TestMethod(DoBackgroundWork), ctx);
            testMethod.Start();
            testMethod.AssertNoException();
        }
예제 #2
0
        public void CurrentProxyIsThreadSafe()
        {
            ProxyTestObjectAndExposeProxy();

            AsyncTestMethod t1 = new AsyncTestMethod(1000, new ThreadStart(ProxyTestObjectAndExposeProxy));
            AsyncTestMethod t2 = new AsyncTestMethod(1000, new ThreadStart(ProxyTestObjectAndExposeProxy));
            t1.Start();
            t2.Start();

            t1.AssertNoException();
            t2.AssertNoException();
        }
        public void GetObjectIsThreadSafe()
        {
            ObjectFactory = CreateObjectFactory(true);

            GenericObjectDefinition theSpouse = new GenericObjectDefinition();
            theSpouse.ObjectTypeName = typeof(TestObject).FullName;
            theSpouse.IsSingleton = false;
            ObjectFactory.RegisterObjectDefinition("theSpouse", theSpouse);

            GenericObjectDefinition theObject = new GenericObjectDefinition();
            theObject.ObjectTypeName = typeof(TestObject).FullName;
            theObject.IsSingleton = false;
            theObject.PropertyValues.Add("Spouse", theSpouse);
            ObjectFactory.RegisterObjectDefinition("theObject", theObject);

            AsyncTestTask t1 = new AsyncTestMethod(20000, new ThreadStart(GetTheTestObject)).Start();
            AsyncTestTask t2 = new AsyncTestMethod(20000, new ThreadStart(GetTheTestObject)).Start();
            AsyncTestTask t3 = new AsyncTestMethod(20000, new ThreadStart(GetTheTestObject)).Start();
            AsyncTestTask t4 = new AsyncTestMethod(20000, new ThreadStart(GetTheTestObject)).Start();

            t1.AssertNoException();
            t2.AssertNoException();
            t3.AssertNoException();
            t4.AssertNoException();
        }
예제 #4
0
        public void ExpressionParserIsThreadSafe()
        {
            AsyncTestTask t1 = new AsyncTestMethod(200, new ThreadStart(TestOperatorPrecedence)).Start();
            AsyncTestTask t2 = new AsyncTestMethod(200, new ThreadStart(TestOperatorPrecedence)).Start();
            AsyncTestTask t3 = new AsyncTestMethod(200, new ThreadStart(TestOperatorPrecedence)).Start();

            t1.AssertNoException();
            t2.AssertNoException();
            t3.AssertNoException();
        }
        public void ProxyFactoryObjectIsThreadSafe()
        {
            const int WORKERS = 10;

            AsyncTestMethod[] workers = new AsyncTestMethod[WORKERS];
            for(int i=0;i<WORKERS;i++)
            {
                workers[i] = new AsyncTestMethod( 1, new ThreadStart( CallGetObject ) );
            }

            for(int i=0;i<WORKERS;i++)
            {
                workers[i].Start();
            }

            for(int i=0;i<WORKERS;i++)
            {
                workers[i].AssertNoException();
            }
        }