Esempio n. 1
0
        public void MultipleStartCalls()
        {
            EasyCollaboration    target  = new EasyCollaboration(context);
            CollaborationSession session = target.StartCollaboration();

            Assert.IsNotNull(session);
            Assert.AreEqual(session, target.StartCollaboration());
            Assert.AreEqual(session, target.StartCollaboration());
            Assert.AreEqual(session, target.StartCollaboration());
            Assert.AreEqual(session, target.StartCollaboration());
            target.ExitCollaboration();
            target  = new EasyCollaboration(context, null, null);
            session = target.StartCollaboration();
            Assert.IsNotNull(session);
            Assert.AreEqual(session, target.StartCollaboration());
            Assert.AreEqual(session, target.StartCollaboration());
            Assert.AreEqual(session, target.StartCollaboration());
            Assert.AreEqual(session, target.StartCollaboration());
            target.ExitCollaboration();
        }
Esempio n. 2
0
        public void ConsumeAnysTest()
        {
            omg.org.CORBA.TypeCode long_tc = context.ORB.create_long_tc();

            EasyCollaboration target = new EasyCollaboration(context);

            target.StartCollaboration();

            List <object> actual = null;

            try
            {
                actual = target.ConsumeAnys();
                Assert.AreEqual(0, actual.Count);

                target.Share(new omg.org.CORBA.Any(11, long_tc));
                target.Share(new omg.org.CORBA.Any(12, long_tc));
                target.Share(new omg.org.CORBA.Any(21, long_tc));
                target.Share(new omg.org.CORBA.Any(22, long_tc));
                Thread.Sleep(4000);
                actual = target.ConsumeAnys();
                Assert.AreEqual(4, actual.Count);
                Assert.AreEqual(11, actual[0]);
                Assert.AreEqual(12, actual[1]);
                Assert.AreEqual(21, actual[2]);
                Assert.AreEqual(22, actual[3]);
            }
            finally
            {
                target.ExitCollaboration();
            }

            target = new EasyCollaboration(context, null, null);
            target.StartCollaboration();
            try
            {
                actual = target.ConsumeAnys();
                Assert.AreEqual(0, actual.Count);

                target.Share(new omg.org.CORBA.Any(11, long_tc));
                target.Share(new omg.org.CORBA.Any(12, long_tc));
                target.Share(new omg.org.CORBA.Any(21, long_tc));
                target.Share(new omg.org.CORBA.Any(22, long_tc));
                Thread.Sleep(2000);
                actual = target.ConsumeAnys();
                Assert.AreEqual(0, actual.Count);
            }
            finally
            {
                target.ExitCollaboration();
            }
        }
Esempio n. 3
0
        public void ConsumeDataKeysTest()
        {
            EasyCollaboration target = new EasyCollaboration(context);

            target.StartCollaboration();
            List <byte[]> actual   = null;
            List <byte[]> datakeys = new List <byte[]>();

            datakeys.Add(ASCIIEncoding.Default.GetBytes("test"));
            datakeys.Add(ASCIIEncoding.Default.GetBytes("test1"));
            datakeys.Add(ASCIIEncoding.Default.GetBytes("test2"));
            datakeys.Add(ASCIIEncoding.Default.GetBytes("test3"));

            omg.org.CORBA.TypeCode byteTC     = context.ORB.create_octet_tc();
            omg.org.CORBA.TypeCode sequenceTC = context.ORB.create_sequence_tc(0, byteTC);

            try
            {
                actual = target.ConsumeDataKeys();
                Assert.AreEqual(0, actual.Count);

                target.ShareDataKeys(datakeys);
                Thread.Sleep(4000);
                actual = target.ConsumeDataKeys();
                Assert.AreEqual(datakeys.Count, actual.Count);
                for (int i = 0; i < datakeys.Count; i++)
                {
                    CollectionAssert.AreEqual(datakeys[i], actual[i]);
                }
            }
            finally
            {
                target.ExitCollaboration();
            }

            target = new EasyCollaboration(context, null, null);
            target.StartCollaboration();
            try
            {
                actual = target.ConsumeDataKeys();
                Assert.AreEqual(0, actual.Count);

                target.ShareDataKeys(datakeys);
                Thread.Sleep(2000);
                actual = target.ConsumeDataKeys();
                Assert.AreEqual(0, actual.Count);
            }
            finally
            {
                target.ExitCollaboration();
            }
        }
Esempio n. 4
0
 private void Start_click(object sender, EventArgs e)
 {
     easy.StartCollaboration();
     start.Enabled = false;
     stop.Enabled  = true;
 }