public override Test.Framework.TestResult Run()
        {
            DDS.ITopic topic;
            Test.Framework.TestResult result;
            test.sacs.MyTopicListener listener;
            string expResult = "TopicListener test succeeded.";

            DDS.ReturnCode rc;
            result = new Test.Framework.TestResult(expResult, string.Empty, Test.Framework.TestVerdict
                                                   .Pass, Test.Framework.TestVerdict.Fail);
            topic    = (DDS.ITopic) this.ResolveObject("topic");
            listener = new test.sacs.MyTopicListener();
            rc       = topic.SetListener(listener, DDS.StatusKind.InconsistentTopic);
            if (rc != DDS.ReturnCode.Ok)
            {
                result.Result = "set_listener on Topic failed.";
                return(result);
            }
            rc = topic.SetListener(null, 0);
            if (rc != DDS.ReturnCode.Ok)
            {
                result.Result = "Null Listener could not be attached.";
                return(result);
            }
            rc = topic.SetListener(listener, DDS.StatusKind.InconsistentTopic);
            if (rc != DDS.ReturnCode.Ok)
            {
                result.Result = "Listener could not be attached (2).";
                return(result);
            }
            rc = topic.SetListener(listener, DDS.StatusKind.InconsistentTopic);
            if (rc != DDS.ReturnCode.Ok)
            {
                result.Result = "Listener could not be attached (3).";
                return(result);
            }
            result.Result  = expResult;
            result.Verdict = Test.Framework.TestVerdict.Pass;
            return(result);
        }
Example #2
0
 public override Test.Framework.TestResult Run()
 {
     DDS.ITopic topic;
     Test.Framework.TestResult result;
     test.sacs.MyTopicListener listener;
     string expResult = "TopicListener test succeeded.";
     DDS.ReturnCode rc;
     result = new Test.Framework.TestResult(expResult, string.Empty, Test.Framework.TestVerdict
         .Pass, Test.Framework.TestVerdict.Fail);
     topic = (DDS.ITopic)this.ResolveObject("topic");
     listener = new test.sacs.MyTopicListener();
     rc = topic.SetListener(listener, DDS.StatusKind.InconsistentTopic);
     if (rc != DDS.ReturnCode.Ok)
     {
         result.Result = "set_listener on Topic failed.";
         return result;
     }
     rc = topic.SetListener(null, 0);
     if (rc != DDS.ReturnCode.Ok)
     {
         result.Result = "Null Listener could not be attached.";
         return result;
     }
     rc = topic.SetListener(listener, DDS.StatusKind.InconsistentTopic);
     if (rc != DDS.ReturnCode.Ok)
     {
         result.Result = "Listener could not be attached (2).";
         return result;
     }
     rc = topic.SetListener(listener, DDS.StatusKind.InconsistentTopic);
     if (rc != DDS.ReturnCode.Ok)
     {
         result.Result = "Listener could not be attached (3).";
         return result;
     }
     result.Result = expResult;
     result.Verdict = Test.Framework.TestVerdict.Pass;
     return result;
 }
Example #3
0
        private static void runListeners(Listener7 listener7, DDS.IEntity entity, int id)
        {
            DDS.ReturnCode rc = DDS.ReturnCode.Error;

            System.Console.Out.WriteLine("Thread {0} started...", id);
            System.Threading.Thread.Sleep(0);
            if (entity is DDS.IDomainParticipant)
            {
                DDS.IDomainParticipantListener listener     = new test.sacs.MyParticipantListener();
                DDS.IDomainParticipant         domainEntity = (DDS.IDomainParticipant)entity;
                rc = (domainEntity).SetListener(listener, DDS.StatusKind.DataAvailable);
                if (rc == DDS.ReturnCode.Ok)
                {
                    rc = domainEntity.SetListener(null, 0);
                    if (rc == DDS.ReturnCode.Ok)
                    {
                        rc = domainEntity.SetListener(listener, DDS.StatusKind.OfferedDeadlineMissed);
                    }
                }
            }
            else
            {
                if (entity is DDS.IPublisher)
                {
                    DDS.IPublisherListener listener     = new test.sacs.MyPublisherListener();
                    DDS.IPublisher         domainEntity = (DDS.IPublisher)entity;
                    rc = domainEntity.SetListener(listener, DDS.StatusKind.RequestedDeadlineMissed);
                    if (rc == DDS.ReturnCode.Ok)
                    {
                        rc = domainEntity.SetListener(null, 0);
                        if (rc == DDS.ReturnCode.Ok)
                        {
                            rc = domainEntity.SetListener(listener, DDS.StatusKind.RequestedIncompatibleQos);
                        }
                    }
                }
                else
                {
                    if (entity is DDS.IDataWriter)
                    {
                        DDS.DataWriterListener listener     = new test.sacs.MyDataWriterListener();
                        DDS.IDataWriter        domainEntity = (DDS.IDataWriter)entity;
                        rc = (domainEntity).SetListener(listener, DDS.StatusKind.RequestedDeadlineMissed);
                        if (rc == DDS.ReturnCode.Ok)
                        {
                            rc = domainEntity.SetListener(null, 0);
                            if (rc == DDS.ReturnCode.Ok)
                            {
                                rc = domainEntity.SetListener(listener, DDS.StatusKind.RequestedIncompatibleQos);
                            }
                        }
                    }
                    else
                    {
                        if (entity is DDS.IDataReader)
                        {
                            DDS.IDataReaderListener listener     = new test.sacs.MyDataReaderListener();
                            DDS.IDataReader         domainEntity = (DDS.IDataReader)entity;
                            rc = (domainEntity).SetListener(listener, DDS.StatusKind.OfferedDeadlineMissed);
                            if (rc == DDS.ReturnCode.Ok)
                            {
                                rc = domainEntity.SetListener(null, 0);
                                if (rc == DDS.ReturnCode.Ok)
                                {
                                    rc = domainEntity.SetListener(listener, DDS.StatusKind.OfferedIncompatibleQos);
                                }
                            }
                        }
                        else
                        {
                            if (entity is DDS.ITopic)
                            {
                                DDS.TopicListener listener     = new test.sacs.MyTopicListener();
                                DDS.ITopic        domainEntity = (DDS.ITopic)entity;
                                rc = (domainEntity).SetListener(listener, DDS.StatusKind.InconsistentTopic);
                                if (rc == DDS.ReturnCode.Ok)
                                {
                                    rc = domainEntity.SetListener(null, 0);
                                    if (rc == DDS.ReturnCode.Ok)
                                    {
                                        rc = domainEntity.SetListener(listener, DDS.StatusKind.InconsistentTopic);
                                    }
                                }
                            }
                            else
                            {
                                if (entity is DDS.ISubscriber)
                                {
                                    DDS.ISubscriberListener listener     = new test.sacs.MySubscriberListener();
                                    DDS.ISubscriber         domainEntity = (DDS.ISubscriber)entity;
                                    rc = (domainEntity).SetListener(listener, DDS.StatusKind.OfferedDeadlineMissed);
                                    if (rc == DDS.ReturnCode.Ok)
                                    {
                                        rc = domainEntity.SetListener(null, 0);
                                        if (rc == DDS.ReturnCode.Ok)
                                        {
                                            rc = domainEntity.SetListener(listener, DDS.StatusKind.DataOnReaders);
                                        }
                                    }
                                }
                                else
                                {
                                    System.Console.Out.WriteLine("Entity type: " + entity.ToString() + " not supported.");
                                }
                            }
                        }
                    }
                }
            }
            System.Console.Out.WriteLine("Thread " + id + " finished.");
        }
Example #4
0
 public void Run()
 {
     System.Console.Out.WriteLine("Thread " + this.id + " started...");
     System.Threading.Thread.Sleep(0);
     if (this.entity is DDS.IDomainParticipant)
     {
         DDS.IDomainParticipantListener listener     = new test.sacs.MyParticipantListener();
         DDS.IDomainParticipant         domainEntity = (DDS.IDomainParticipant) this.entity;
         this.rc = (domainEntity).SetListener(listener, DDS.StatusKind.DataAvailable);
         if (this.rc == DDS.ReturnCode.Ok)
         {
             this.rc = domainEntity.SetListener(null, 0);
             if (this.rc == DDS.ReturnCode.Ok)
             {
                 this.rc = domainEntity.SetListener(listener, DDS.StatusKind.OfferedDeadlineMissed);
             }
         }
     }
     else if (this.entity is DDS.IPublisher)
     {
         DDS.IPublisherListener listener     = new test.sacs.MyPublisherListener();
         DDS.IPublisher         domainEntity = (DDS.IPublisher) this.entity;
         this.rc = domainEntity.SetListener(listener, DDS.StatusKind.RequestedDeadlineMissed);
         if (this.rc == DDS.ReturnCode.Ok)
         {
             this.rc = domainEntity.SetListener(null, 0);
             if (this.rc == DDS.ReturnCode.Ok)
             {
                 this.rc = domainEntity.SetListener(listener, DDS.StatusKind.RequestedIncompatibleQos);
             }
         }
     }
     else if (this.entity is DDS.IDataWriter)
     {
         DDS.DataWriterListener listener     = new test.sacs.MyDataWriterListener();
         DDS.IDataWriter        domainEntity = (DDS.IDataWriter) this.entity;
         this.rc = (domainEntity).SetListener(listener, DDS.StatusKind.RequestedDeadlineMissed);
         if (this.rc == DDS.ReturnCode.Ok)
         {
             this.rc = domainEntity.SetListener(null, 0);
             if (this.rc == DDS.ReturnCode.Ok)
             {
                 this.rc = domainEntity.SetListener(listener, DDS.StatusKind.RequestedIncompatibleQos);
             }
         }
     }
     else if (this.entity is DDS.IDataReader)
     {
         DDS.IDataReaderListener listener     = new test.sacs.MyDataReaderListener();
         DDS.IDataReader         domainEntity = (DDS.IDataReader) this.entity;
         this.rc = (domainEntity).SetListener(listener, DDS.StatusKind.OfferedDeadlineMissed);
         if (this.rc == DDS.ReturnCode.Ok)
         {
             this.rc = domainEntity.SetListener(null, 0);
             if (this.rc == DDS.ReturnCode.Ok)
             {
                 this.rc = domainEntity.SetListener(listener, DDS.StatusKind.OfferedIncompatibleQos);
             }
         }
     }
     else if (this.entity is DDS.ITopic)
     {
         DDS.TopicListener listener     = new test.sacs.MyTopicListener();
         DDS.ITopic        domainEntity = (DDS.ITopic) this.entity;
         this.rc = (domainEntity).SetListener(listener, DDS.StatusKind.InconsistentTopic);
         if (this.rc == DDS.ReturnCode.Ok)
         {
             this.rc = domainEntity.SetListener(null, 0);
             if (this.rc == DDS.ReturnCode.Ok)
             {
                 this.rc = domainEntity.SetListener(listener, DDS.StatusKind.InconsistentTopic);
             }
         }
     }
     else if (this.entity is DDS.ISubscriber)
     {
         DDS.ISubscriberListener listener     = new test.sacs.MySubscriberListener();
         DDS.ISubscriber         domainEntity = (DDS.ISubscriber) this.entity;
         this.rc = (domainEntity).SetListener(listener, DDS.StatusKind.OfferedDeadlineMissed);
         if (this.rc == DDS.ReturnCode.Ok)
         {
             this.rc = domainEntity.SetListener(null, 0);
             if (this.rc == DDS.ReturnCode.Ok)
             {
                 this.rc = domainEntity.SetListener(listener, DDS.StatusKind.DataOnReaders);
             }
         }
     }
     else
     {
         System.Console.Out.WriteLine("Entity type: " + this.entity.ToString() + " not supported.");
     }
     System.Console.Out.WriteLine("Thread " + this.id + " finished.");
 }
Example #5
0
        private static void runListeners(Listener7 listener7, DDS.IEntity entity, int id)
        {
            DDS.ReturnCode rc = DDS.ReturnCode.Error;

            System.Console.Out.WriteLine("Thread {0} started...", id);
            System.Threading.Thread.Sleep(0);
            if (entity is DDS.IDomainParticipant)
            {
                DDS.IDomainParticipantListener listener = new test.sacs.MyParticipantListener();
                DDS.IDomainParticipant domainEntity = (DDS.IDomainParticipant)entity;
                rc = (domainEntity).SetListener(listener, DDS.StatusKind.DataAvailable);
                if (rc == DDS.ReturnCode.Ok)
                {
                    rc = domainEntity.SetListener(null, 0);
                    if (rc == DDS.ReturnCode.Ok)
                    {
                        rc = domainEntity.SetListener(listener, DDS.StatusKind.OfferedDeadlineMissed);
                    }
                }
            }
            else
            {
                if (entity is DDS.IPublisher)
                {
                    DDS.IPublisherListener listener = new test.sacs.MyPublisherListener();
                    DDS.IPublisher domainEntity = (DDS.IPublisher)entity;
                    rc = domainEntity.SetListener(listener, DDS.StatusKind.RequestedDeadlineMissed);
                    if (rc == DDS.ReturnCode.Ok)
                    {
                        rc = domainEntity.SetListener(null, 0);
                        if (rc == DDS.ReturnCode.Ok)
                        {
                            rc = domainEntity.SetListener(listener, DDS.StatusKind.RequestedIncompatibleQos);
                        }
                    }
                }
                else
                {
                    if (entity is DDS.IDataWriter)
                    {
                        DDS.DataWriterListener listener = new test.sacs.MyDataWriterListener();
                        DDS.IDataWriter domainEntity = (DDS.IDataWriter)entity;
                        rc = (domainEntity).SetListener(listener, DDS.StatusKind.RequestedDeadlineMissed);
                        if (rc == DDS.ReturnCode.Ok)
                        {
                            rc = domainEntity.SetListener(null, 0);
                            if (rc == DDS.ReturnCode.Ok)
                            {
                                rc = domainEntity.SetListener(listener, DDS.StatusKind.RequestedIncompatibleQos);
                            }
                        }
                    }
                    else
                    {
                        if (entity is DDS.IDataReader)
                        {
                            DDS.IDataReaderListener listener = new test.sacs.MyDataReaderListener();
                            DDS.IDataReader domainEntity = (DDS.IDataReader)entity;
                            rc = (domainEntity).SetListener(listener, DDS.StatusKind.OfferedDeadlineMissed);
                            if (rc == DDS.ReturnCode.Ok)
                            {
                                rc = domainEntity.SetListener(null, 0);
                                if (rc == DDS.ReturnCode.Ok)
                                {
                                    rc = domainEntity.SetListener(listener, DDS.StatusKind.OfferedIncompatibleQos);
                                }
                            }
                        }
                        else
                        {
                            if (entity is DDS.ITopic)
                            {
                                DDS.TopicListener listener = new test.sacs.MyTopicListener();
                                DDS.ITopic domainEntity = (DDS.ITopic)entity;
                                rc = (domainEntity).SetListener(listener, DDS.StatusKind.InconsistentTopic);
                                if (rc == DDS.ReturnCode.Ok)
                                {
                                    rc = domainEntity.SetListener(null, 0);
                                    if (rc == DDS.ReturnCode.Ok)
                                    {
                                        rc = domainEntity.SetListener(listener, DDS.StatusKind.InconsistentTopic);
                                    }
                                }
                            }
                            else
                            {
                                if (entity is DDS.ISubscriber)
                                {
                                    DDS.ISubscriberListener listener = new test.sacs.MySubscriberListener();
                                    DDS.ISubscriber domainEntity = (DDS.ISubscriber)entity;
                                    rc = (domainEntity).SetListener(listener, DDS.StatusKind.OfferedDeadlineMissed);
                                    if (rc == DDS.ReturnCode.Ok)
                                    {
                                        rc = domainEntity.SetListener(null, 0);
                                        if (rc == DDS.ReturnCode.Ok)
                                        {
                                            rc = domainEntity.SetListener(listener, DDS.StatusKind.DataOnReaders);
                                        }
                                    }
                                }
                                else
                                {
                                    System.Console.Out.WriteLine("Entity type: " + entity.ToString() + " not supported.");
                                }
                            }
                        }
                    }
                }
            }
            System.Console.Out.WriteLine("Thread " + id + " finished.");
        }
Example #6
0
 public void Run()
 {
     System.Console.Out.WriteLine("Thread " + this.id + " started...");
     System.Threading.Thread.Sleep(0);
     if (this.entity is DDS.IDomainParticipant)
     {
         DDS.IDomainParticipantListener listener = new test.sacs.MyParticipantListener();
         DDS.IDomainParticipant domainEntity = (DDS.IDomainParticipant)this.entity;
         this.rc = (domainEntity).SetListener(listener, DDS.StatusKind.DataAvailable);
         if (this.rc == DDS.ReturnCode.Ok)
         {
             this.rc = domainEntity.SetListener(null, 0);
             if (this.rc == DDS.ReturnCode.Ok)
             {
                 this.rc = domainEntity.SetListener(listener, DDS.StatusKind.OfferedDeadlineMissed);
             }
         }
     }
     else if (this.entity is DDS.IPublisher)
     {
         DDS.IPublisherListener listener = new test.sacs.MyPublisherListener();
         DDS.IPublisher domainEntity = (DDS.IPublisher)this.entity;
         this.rc = domainEntity.SetListener(listener, DDS.StatusKind.RequestedDeadlineMissed);
         if (this.rc == DDS.ReturnCode.Ok)
         {
             this.rc = domainEntity.SetListener(null, 0);
             if (this.rc == DDS.ReturnCode.Ok)
             {
                 this.rc = domainEntity.SetListener(listener, DDS.StatusKind.RequestedIncompatibleQos);
             }
         }
     }
     else if (this.entity is DDS.IDataWriter)
     {
         DDS.DataWriterListener listener = new test.sacs.MyDataWriterListener();
         DDS.IDataWriter domainEntity = (DDS.IDataWriter)this.entity;
         this.rc = (domainEntity).SetListener(listener, DDS.StatusKind.RequestedDeadlineMissed);
         if (this.rc == DDS.ReturnCode.Ok)
         {
             this.rc = domainEntity.SetListener(null, 0);
             if (this.rc == DDS.ReturnCode.Ok)
             {
                 this.rc = domainEntity.SetListener(listener, DDS.StatusKind.RequestedIncompatibleQos);
             }
         }
     }
     else if (this.entity is DDS.IDataReader)
     {
         DDS.IDataReaderListener listener = new test.sacs.MyDataReaderListener();
         DDS.IDataReader domainEntity = (DDS.IDataReader)this.entity;
         this.rc = (domainEntity).SetListener(listener, DDS.StatusKind.OfferedDeadlineMissed);
         if (this.rc == DDS.ReturnCode.Ok)
         {
             this.rc = domainEntity.SetListener(null, 0);
             if (this.rc == DDS.ReturnCode.Ok)
             {
                 this.rc = domainEntity.SetListener(listener, DDS.StatusKind.OfferedIncompatibleQos);
             }
         }
     }
     else if (this.entity is DDS.ITopic)
     {
         DDS.TopicListener listener = new test.sacs.MyTopicListener();
         DDS.ITopic domainEntity = (DDS.ITopic)this.entity;
         this.rc = (domainEntity).SetListener(listener, DDS.StatusKind.InconsistentTopic);
         if (this.rc == DDS.ReturnCode.Ok)
         {
             this.rc = domainEntity.SetListener(null, 0);
             if (this.rc == DDS.ReturnCode.Ok)
             {
                 this.rc = domainEntity.SetListener(listener, DDS.StatusKind.InconsistentTopic);
             }
         }
     }
     else if (this.entity is DDS.ISubscriber)
     {
         DDS.ISubscriberListener listener = new test.sacs.MySubscriberListener();
         DDS.ISubscriber domainEntity = (DDS.ISubscriber)this.entity;
         this.rc = (domainEntity).SetListener(listener, DDS.StatusKind.OfferedDeadlineMissed);
         if (this.rc == DDS.ReturnCode.Ok)
         {
             this.rc = domainEntity.SetListener(null, 0);
             if (this.rc == DDS.ReturnCode.Ok)
             {
                 this.rc = domainEntity.SetListener(listener, DDS.StatusKind.DataOnReaders);
             }
         }
     }
     else
     {
         System.Console.Out.WriteLine("Entity type: " + this.entity.ToString() + " not supported.");
     }
     System.Console.Out.WriteLine("Thread " + this.id + " finished.");
 }