Beispiel #1
0
        public static void TestContractA_TwoWayCall_Timeout(string CONF_SRC)
        {
            TestServerA.s_Accumulator = 0;

            var conf = LaconicConfiguration.CreateFromString(CONF_SRC);

            using (var app = new ServiceBaseApplication(null, conf.Root))
            {
                var cl = new TestContractAClient(App.ConfigRoot.AttrByName("cs").Value);
                cl.TimeoutMs = 2000;

                try
                {
                    cl.Sleeper(5000);
                }
                catch (ClientCallException err)
                {
                    Assert.AreEqual(CallStatus.Timeout, err.CallStatus);
                    return;
                }
                catch (System.IO.IOException err) //sync binding throws IO exception
                {
                    Assert.IsTrue(err.Message.Contains("after a period of time"));
                    return;
                }

                Assert.Fail("Invalid Call status");
            }
        }
Beispiel #2
0
        public static void TASK_TestContractA_TwoWayCall_Timeout(string CONF_SRC)
        {
            TestServerA.s_Accumulator = 0;

            var conf = LaconicConfiguration.CreateFromString(CONF_SRC);

            using (var app = new ServiceBaseApplication(null, conf.Root))
            {
                var cl = new TestContractAClient(App.ConfigRoot.AttrByName("cs").Value);
                cl.TimeoutMs = 2000;

                System.Threading.Tasks.Task <CallSlot> task = null;
                try
                {
                    task = cl.Async_Sleeper(10000).AsTask;
                    task.Result.GetValue <int>();
                }
                catch (ClientCallException err)
                {
                    Assert.AreEqual(CallStatus.Timeout, err.CallStatus);
                    return;
                }
                catch (System.IO.IOException err) //sync binding throws IO exception
                {
                    Assert.IsTrue(err.Message.Contains("after a period of time"));
                    return;
                }

                Assert.Fail("Invalid Call status: " + (task != null ? task.Result.CallStatus.ToString() : "task==null"));
            }
        }
Beispiel #3
0
        public static void TestContractA_TwoWayCall(string CONF_SRC)
        {
            TestServerA.s_Accumulator = 0;

            var conf = LaconicConfiguration.CreateFromString(CONF_SRC);

            using (var app = new ServiceBaseApplication(null, conf.Root))
            {
                var cl = new TestContractAClient(App.ConfigRoot.AttrByName("cs").Value);

                var result = cl.Method1(12);
                Assert.AreEqual("12", result);
                Assert.AreEqual(12, TestServerA.s_Accumulator);
            }
        }
Beispiel #4
0
        public static void TASK_TestContractA_TwoWayCall(string CONF_SRC)
        {
            TestServerA.s_Accumulator = 0;

            var conf = LaconicConfiguration.CreateFromString(CONF_SRC);
            using( var app = new ServiceBaseApplication(null, conf.Root))
            {
                var cl = new TestContractAClient(App.ConfigRoot.AttrByName("cs").Value);

                var call = cl.Async_Method1(12);
                var task = call.AsTask;

                var result = task.Result.GetValue<string>();

                Assert.AreEqual( "12", result);
                Assert.AreEqual(12, TestServerA.s_Accumulator);
            }
        }
Beispiel #5
0
        public static void TestContractA_OneWayCall(string CONF_SRC)
        {
            TestServerA.s_Accumulator = 0;

            var conf = LaconicConfiguration.CreateFromString(CONF_SRC);

            using (var app = new ServiceBaseApplication(null, conf.Root))
            {
                var cl = new TestContractAClient(App.ConfigRoot.AttrByName("cs").Value);

                cl.Method2(93);

                for (var cnt = 0; cnt < 10 && TestServerA.s_Accumulator != 93; cnt++)
                {
                    System.Threading.Thread.Sleep(1000);
                }

                Assert.AreEqual(93, TestServerA.s_Accumulator);
            }
        }
Beispiel #6
0
        public static void TASK_TestContractA_TwoWayCall_Timeout(string CONF_SRC)
        {
            TestServerA.s_Accumulator = 0;

            var conf = LaconicConfiguration.CreateFromString(CONF_SRC);
            using( var app = new ServiceBaseApplication(null, conf.Root))
            {
                var cl = new TestContractAClient(App.ConfigRoot.AttrByName("cs").Value);
                cl.TimeoutMs = 2000;

                System.Threading.Tasks.Task<CallSlot> task = null;
                try
                {
                  task = cl.Async_Sleeper(10000).AsTask;
                  task.Result.GetValue<int>();
                }
                catch(ClientCallException err)
                {
                  Assert.AreEqual(CallStatus.Timeout, err.CallStatus);
                  return;
                }
                catch(System.IO.IOException err) //sync binding throws IO exception
                {
                  Assert.IsTrue( err.Message.Contains("after a period of time") );
                  return;
                }

                Assert.Fail("Invalid Call status: " + (task!=null ? task.Result.CallStatus.ToString() : "task==null"));
            }
        }
Beispiel #7
0
        public static void TestContractA_TwoWayCall_Timeout(string CONF_SRC)
        {
            TestServerA.s_Accumulator = 0;

            var conf = LaconicConfiguration.CreateFromString(CONF_SRC);
            using( var app = new ServiceBaseApplication(null, conf.Root))
            {
                var cl = new TestContractAClient(App.ConfigRoot.AttrByName("cs").Value);
                cl.TimeoutMs = 2000;

                try
                {
                  cl.Sleeper(5000);
                }
                catch(ClientCallException err)
                {
                  Assert.AreEqual(CallStatus.Timeout, err.CallStatus);
                  return;
                }
                catch(System.IO.IOException err) //sync binding throws IO exception
                {
                  Assert.IsTrue( err.Message.Contains("after a period of time") );
                  return;
                }

                Assert.Fail("Invalid Call status");
            }
        }
Beispiel #8
0
        public static void TestContractA_OneWayCall(string CONF_SRC)
        {
            TestServerA.s_Accumulator = 0;

            var conf = LaconicConfiguration.CreateFromString(CONF_SRC);
            using( var app = new ServiceBaseApplication(null, conf.Root))
            {
                var cl = new TestContractAClient(App.ConfigRoot.AttrByName("cs").Value);

                cl.Method2(93);

                for(var cnt=0; cnt<10 && TestServerA.s_Accumulator!=93 ; cnt++)
                    System.Threading.Thread.Sleep(1000);

                Assert.AreEqual(93,TestServerA.s_Accumulator);
            }
        }