Ejemplo n.º 1
0
 public override Test.Framework.TestResult Run(Test.Framework.TestCase testCase)
 {
     DDS.IDomainParticipant participant;
     mod.tstTypeSupport typeSupport;
     DDS.TopicQos topicQos;
     DDS.ITopic topic;
     DDS.ReturnCode rc;
     Test.Framework.TestResult result;
     participant = (DDS.IDomainParticipant)testCase.ResolveObject("participant");
     typeSupport = (mod.tstTypeSupport)testCase.ResolveObject("typeSupport");
     topicQos = (DDS.TopicQos)testCase.ResolveObject("topicQos");
     result = new Test.Framework.TestResult("Initialization 3 success", string.Empty,
         Test.Framework.TestVerdict.Pass, Test.Framework.TestVerdict.Fail);
     rc = typeSupport.RegisterType(participant, "my_other_type");
     if (rc != DDS.ReturnCode.Ok)
     {
         result.Result = "Register type failed.";
         return result;
     }
     topic = participant.CreateTopic("my_other_topic", "my_other_type", topicQos);//, null, 0);
     if (topic == null)
     {
         result.Result = "Topic could not be created.";
         return result;
     }
     testCase.RegisterObject("otherTopic", topic);
     result.Result = "Initialization success.";
     result.Verdict = Test.Framework.TestVerdict.Pass;
     return result;
 }
        public override Test.Framework.TestResult Run(Test.Framework.TestCase testCase)
        {
            DDS.IDomainParticipant participant;
			DDS.SubscriberQos subscriberQosHolder = null;
            DDS.ISubscriber subscriber;
            Test.Framework.TestResult result;
            DDS.ITopic topic;
            participant = (DDS.IDomainParticipant)testCase.ResolveObject("participant");
            topic = (DDS.ITopic)testCase.ResolveObject("topic");
            result = new Test.Framework.TestResult("Initialization success", string.Empty, Test.Framework.TestVerdict.Pass,
                Test.Framework.TestVerdict.Fail);
            if (participant == null || topic == null)
            {
                System.Console.Error.WriteLine("participant or topic = null");
                result.Result = "precondition not met";
                return result;
            }

            if (participant.GetDefaultSubscriberQos(ref subscriberQosHolder) != DDS.ReturnCode.Ok)
            {
                result.Result = "could not get default SubscriberQos";
                return result;
            }
            subscriber = participant.CreateSubscriber(subscriberQosHolder);//, null, DDS.StatusKind.Any);
            if (subscriber == null)
            {
                result.Result = "could create a Subscriber";
                return result;
            }
            testCase.RegisterObject("subscriber", subscriber);
            result.Result = "Initialization success.";
            result.Verdict = Test.Framework.TestVerdict.Pass;
            return result;
        }
Ejemplo n.º 3
0
 public override Test.Framework.TestResult Run(Test.Framework.TestCase testCase)
 {
     DDS.IDomainParticipantFactory factory;
     DDS.IDomainParticipant participant;
     Test.Framework.TestResult result;
     DDS.ReturnCode rc;
     result = new Test.Framework.TestResult("Deinitialization success", string.Empty,
         Test.Framework.TestVerdict.Pass, Test.Framework.TestVerdict.Fail);
     factory = (DDS.IDomainParticipantFactory)testCase.ResolveObject("factory");
     participant = (DDS.IDomainParticipant)testCase.ResolveObject("participant");
     if (participant == null)
     {
         result.Result = "DomainParticipant could not be found.";
         return result;
     }
     rc = participant.DeleteContainedEntities();
     if (rc != DDS.ReturnCode.Ok)
     {
         result.Result = "Could not delete contained entities of DomainParticipant.";
         return result;
     }
     rc = factory.DeleteParticipant(participant);
     if (rc != DDS.ReturnCode.Ok)
     {
         result.Result = "Could not delete DomainParticipant.";
         return result;
     }
     testCase.UnregisterObject("participant");
     testCase.UnregisterObject("participantQos");
     testCase.UnregisterObject("factory");
     result.Result = "Deinitialization success.";
     result.Verdict = Test.Framework.TestVerdict.Pass;
     return result;
 }
 public override Test.Framework.TestResult Run(Test.Framework.TestCase testCase)
 {
     DDS.IDomainParticipant participant;
     DDS.ISubscriber subscriber;
     DDS.ReturnCode rc;
     Test.Framework.TestResult result;
     participant = (DDS.IDomainParticipant)testCase.ResolveObject("participant");
     subscriber = (DDS.ISubscriber)testCase.ResolveObject("subscriber");
     result = new Test.Framework.TestResult("Initialization success", string.Empty, Test.Framework.TestVerdict.Pass,
         Test.Framework.TestVerdict.Fail);
     if (participant == null || subscriber == null)
     {
         System.Console.Error.WriteLine("participant or subscriber = null");
         result.Result = "precondition not met";
         return result;
     }
     rc = participant.DeleteSubscriber(subscriber);
     if (rc != DDS.ReturnCode.Ok)
     {
         result.Result = "could not delete a subscriber";
         return result;
     }
     testCase.UnregisterObject("subscriber");
     result.Result = "Initialization success.";
     result.Verdict = Test.Framework.TestVerdict.Pass;
     return result;
 }
 public override Test.Framework.TestResult Run(Test.Framework.TestCase testCase)
 {
     string expectedResult = "Topic is deinitialized";
     DDS.IDomainParticipant participant;
     DDS.ITopic topic;
     DDS.ReturnCode rc;
     Test.Framework.TestResult result;
     result = new Test.Framework.TestResult(expectedResult, string.Empty, Test.Framework.TestVerdict.Pass,
         Test.Framework.TestVerdict.Fail);
     participant = (DDS.IDomainParticipant)testCase.ResolveObject("participant");
     topic = (DDS.ITopic)testCase.ResolveObject("topic");
     rc = participant.DeleteTopic(topic);
     if (rc == DDS.ReturnCode.PreconditionNotMet)
     {
         rc = participant.DeleteContainedEntities();
     }
     if (rc != DDS.ReturnCode.Ok)
     {
         result.Result = "Recieved return code " + rc + " after calling participant.delete_topic";
         return result;
     }
     testCase.UnregisterObject("topic");
     result.Result = expectedResult;
     result.Verdict = Test.Framework.TestVerdict.Pass;
     return result;
 }
Ejemplo n.º 6
0
 public override Test.Framework.TestResult Run(Test.Framework.TestCase testCase)
 {
     DDS.IDomainParticipant participant;
     DDS.ITopic topic;
     DDS.ReturnCode rc;
     Test.Framework.TestResult result;
     result = new Test.Framework.TestResult("Deinitialization success", string.Empty,
         Test.Framework.TestVerdict.Pass, Test.Framework.TestVerdict.Fail);
     participant = (DDS.IDomainParticipant)testCase.ResolveObject("participant");
     topic = (DDS.ITopic)testCase.ResolveObject("topic");
     rc = participant.DeleteTopic(topic);
     if (rc != DDS.ReturnCode.Ok)
     {
         if (rc == DDS.ReturnCode.PreconditionNotMet)
         {
             rc = participant.DeleteContainedEntities();
         }
         if (rc != DDS.ReturnCode.Ok)
         {
             result.Result = "Could not delete Topic.";
             return result;
         }
     }
     testCase.UnregisterObject("topic");
     result.Result = "Deinitialization success.";
     result.Verdict = Test.Framework.TestVerdict.Pass;
     return result;
 }
Ejemplo n.º 7
0
        public override Test.Framework.TestResult Run(Test.Framework.TestCase testCase)
        {
            DDS.IDomainParticipant participant;
			DDS.TopicQos topQosHolder = null;
            DDS.ITopic topic;
            mod.tstTypeSupport typeSupport = null;
            Test.Framework.TestResult result;
            DDS.ReturnCode rc;
            result = new Test.Framework.TestResult("Initialization success", string.Empty, Test.Framework.TestVerdict.Pass,
                Test.Framework.TestVerdict.Fail);
            participant = (DDS.IDomainParticipant)testCase.ResolveObject("participant");
            typeSupport = new mod.tstTypeSupport();
            if (typeSupport == null)
            {
                result.Result = "Creation of tstTypeSupport failed.";
                return result;
            }
            rc = typeSupport.RegisterType(participant, "my_type");
            if (rc != DDS.ReturnCode.Ok)
            {
                result.Result = "Register type failed.";
                return result;
            }

            if (participant.GetDefaultTopicQos(ref topQosHolder) != DDS.ReturnCode.Ok)
            {
                result.Result = "Default TopicQos could not be resolved.";
                return result;
            }
            topic = participant.CreateTopic("my_topic", "my_type", topQosHolder);//, null, 0);
            if (topic == null)
            {
                result.Result = "Topic could not be created.";
                return result;
            }
            testCase.RegisterObject("topic", topic);
            testCase.RegisterObject("topicQos", topQosHolder);
            testCase.RegisterObject("typeSupport", typeSupport);
            result.Result = "Initialization success.";
            result.Verdict = Test.Framework.TestVerdict.Pass;
            return result;
        }
Ejemplo n.º 8
0
        public override Test.Framework.TestResult Run(Test.Framework.TestCase testCase)
        {
            string filteredTypeName = "my_filtered_topic";
            string filterExpression = "long_1 < %0";
            //        final String expressionParameters[] = {"1", "2", "3"};
            string[] expressionParameters = new string[] { "1" };
            DDS.IDomainParticipant participant;
            DDS.ITopic topic;
            DDS.IContentFilteredTopic filteredTopic;
            DDS.IPublisher publisher;
            DDS.ISubscriber subscriber;
            mod.tstDataReader reader;
            mod.tstDataWriter writer;
            DDS.PublisherQos publisherQos = null;
            DDS.SubscriberQos subscriberQos = null;
            DDS.DataReaderQos dataReaderQos = null;
            DDS.DataWriterQos dataWriterQos = null;
            Test.Framework.TestResult result;
            participant = (DDS.IDomainParticipant)testCase.ResolveObject("participant");
            topic = (DDS.ITopic)testCase.ResolveObject("topic");
            result = new Test.Framework.TestResult("Initialization success", string.Empty, Test.Framework.TestVerdict.Pass,
                Test.Framework.TestVerdict.Fail);
            filteredTopic = participant.CreateContentFilteredTopic(filteredTypeName, topic,
                filterExpression, expressionParameters);
            if (filteredTopic == null)
            {
                result.Result = "participant.create_contentfilteredtopic failed (1).";
                return result;
            }

            if (participant.GetDefaultPublisherQos(ref publisherQos) != DDS.ReturnCode.Ok)
            {
                result.Result = "participant.get_default_publisher_qos failed (2).";
                return result;
            }
            publisher = participant.CreatePublisher(publisherQos);//, null, 0);
            if (publisher == null)
            {
                result.Result = "participant.create_publisher failed (3).";
                return result;
            }

            if (publisher.GetDefaultDataWriterQos(ref dataWriterQos) != DDS.ReturnCode.Ok)
            {
                result.Result = "publisher.get_default_datawriter_qos failed (4).";
                return result;
            }

            writer = publisher.CreateDataWriter(topic, dataWriterQos) as mod.tstDataWriter;
            if (writer == null)
            {
                result.Result = "could not create a tstDataWriter (5).";
                return result;
            }

            if (participant.GetDefaultSubscriberQos(ref subscriberQos) != DDS.ReturnCode.Ok)
            {
                result.Result = "participant.get_default_subscriber_qos failed (6).";
                return result;
            }
            subscriber = participant.CreateSubscriber(subscriberQos);//, null, 0);
            if (subscriber == null)
            {
                result.Result = "participant.create_subscriber failed (7).";
                return result;
            }

            if (subscriber.GetDefaultDataReaderQos(ref dataReaderQos) != DDS.ReturnCode.Ok)
            {
                result.Result = "subscriber.get_default_datareader_qos failed (8).";
                return result;
            }

            reader = subscriber.CreateDataReader(filteredTopic, dataReaderQos) as mod.tstDataReader;
            if (reader == null)
            {
                result.Result = "subscriber.create_datareader failed (9).";
                return result;
            }
            testCase.RegisterObject("filteredTopic", filteredTopic);
            testCase.RegisterObject("publisher", publisher);
            testCase.RegisterObject("subscriber", subscriber);
            testCase.RegisterObject("reader", reader);
            testCase.RegisterObject("dataReaderQos", dataReaderQos);
            testCase.RegisterObject("writer", writer);
            result.Result = "Initialization success.";
            result.Verdict = Test.Framework.TestVerdict.Pass;
            return result;
        }
Ejemplo n.º 9
0
 public override Test.Framework.TestResult Run(Test.Framework.TestCase testCase)
 {
     //resolve reader
     //resolve writer
     //resolve contentFilteredTopic
     //resolve publisher
     //resolve subscriber
     DDS.IDomainParticipant participant;
     DDS.IContentFilteredTopic contentFilteredTopic;
     DDS.IPublisher publisher;
     DDS.ISubscriber subscriber;
     mod.tstDataReader reader;
     mod.tstDataWriter writer;
     Test.Framework.TestResult result;
     DDS.ReturnCode rc;
     result = new Test.Framework.TestResult("Deinitialization success", string.Empty,
         Test.Framework.TestVerdict.Pass, Test.Framework.TestVerdict.Fail);
     participant = (DDS.IDomainParticipant)testCase.ResolveObject("participant");
     contentFilteredTopic = (DDS.IContentFilteredTopic)testCase.ResolveObject("filteredTopic"
         );
     publisher = (DDS.IPublisher)testCase.ResolveObject("publisher");
     subscriber = (DDS.ISubscriber)testCase.ResolveObject("subscriber");
     reader = (mod.tstDataReader)testCase.ResolveObject("reader");
     writer = (mod.tstDataWriter)testCase.ResolveObject("writer");
     rc = publisher.DeleteDataWriter(writer);
     if (rc != DDS.ReturnCode.Ok)
     {
         result.Result = "Could not delete DataWriter.";
         return result;
     }
     rc = subscriber.DeleteDataReader(reader);
     if (rc != DDS.ReturnCode.Ok)
     {
         result.Result = "Could not delete DataReader.";
         return result;
     }
     rc = participant.DeleteContentFilteredTopic(contentFilteredTopic);
     if (rc != DDS.ReturnCode.Ok)
     {
         result.Result = "Could not delete ContentFilteredTopic.";
         return result;
     }
     rc = participant.DeletePublisher(publisher);
     if (rc != DDS.ReturnCode.Ok)
     {
         result.Result = "Could not delete Publisher.";
         return result;
     }
     rc = participant.DeleteSubscriber(subscriber);
     if (rc != DDS.ReturnCode.Ok)
     {
         result.Result = "Could not delete Subscriber.";
         return result;
     }
     testCase.UnregisterObject("filteredTopic");
     testCase.UnregisterObject("publisher");
     testCase.UnregisterObject("subscriber");
     testCase.UnregisterObject("reader");
     testCase.UnregisterObject("writer");
     testCase.UnregisterObject("dataReaderQos");
     result.Result = "Deinitialization success.";
     result.Verdict = Test.Framework.TestVerdict.Pass;
     return result;
 }