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.DomainParticipantFactory factory;
            DDS.IDomainParticipant       participant;
            DDS.DomainParticipantQos     pqosHolder = null;
            Test.Framework.TestResult    result;
            result = new Test.Framework.TestResult("Initialization success", string.Empty, Test.Framework.TestVerdict.Pass,
                                                   Test.Framework.TestVerdict.Fail);
            factory = DDS.DomainParticipantFactory.Instance;
            if (factory == null)
            {
                result.Result = "DomainParticipantFactory could not be initialized.";
                return(result);
            }

            if (factory.GetDefaultParticipantQos(ref pqosHolder) != DDS.ReturnCode.Ok)
            {
                result.Result = "Default DomainParticipantQos could not be resolved.";
                return(result);
            }
            participant = factory.CreateParticipant(string.Empty, pqosHolder);//, null, 0);
            if (participant == null)
            {
                result.Result = "Creation of DomainParticipant failed.";
                return(result);
            }
            testCase.RegisterObject("participantQos", pqosHolder);
            testCase.RegisterObject("factory", factory);
            testCase.RegisterObject("participant", participant);
            result.Result  = "Initialization success.";
            result.Verdict = Test.Framework.TestVerdict.Pass;
            return(result);
        }
Example #3
0
        public override Test.Framework.TestResult Run(Test.Framework.TestCase testCase)
        {
            Test.Framework.TestResult    result;
            DDS.DomainParticipantFactory factory;
            DDS.DomainParticipantQos     qosHolder = null;
            DDS.IDomainParticipant       participant1;
            DDS.ReturnCode rc;
            result = new Test.Framework.TestResult("newly created DomainParticipant", "newly created DomainParticipant"
                                                   , Test.Framework.TestVerdict.Pass, Test.Framework.TestVerdict.Pass);
            factory = DDS.DomainParticipantFactory.Instance;
            if (factory == null)
            {
                result.Result  = "failure creating a DomainParticipantFactory";
                result.Verdict = Test.Framework.TestVerdict.Fail;
                return(result);
            }

            rc = factory.GetDefaultParticipantQos(ref qosHolder);
            if (rc != DDS.ReturnCode.Ok)
            {
                result.Result  = "failure resolving the default participant qos (" + rc + ").";
                result.Verdict = Test.Framework.TestVerdict.Fail;
                return(result);
            }
            participant1 = factory.CreateParticipant(DDS.DomainId.Default, qosHolder);//, null, 0);
            if (participant1 == null)
            {
                result.Result  = "failure creating a DomainParticipant using null as qos parameter";
                result.Verdict = Test.Framework.TestVerdict.Fail;
                return(result);
            }
            testCase.RegisterObject("theFactory", factory);
            testCase.RegisterObject("participant1", participant1);
            return(result);
        }
 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);
 }
Example #5
0
        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);
        }
Example #6
0
        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);
        }
Example #7
0
 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)
 {
     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);
 }
        public override Test.Framework.TestResult Run(Test.Framework.TestCase testCase)
        {
            Test.Framework.TestResult result = null;
            //DDS.DomainParticipantFactory.Instance;
            DDS.GuardCondition condition1 = new DDS.GuardCondition();
            DDS.GuardCondition condition2 = new DDS.GuardCondition();
            DDS.GuardCondition condition3 = new DDS.GuardCondition();
            testCase.RegisterObject("condition1", condition1);
            testCase.RegisterObject("condition2", condition2);
            testCase.RegisterObject("condition3", condition3);

            // TODO: JLS, should one of these TestVerdicts be Fail?
            result = new Test.Framework.TestResult("creation of 3 GuardCondions is succesfull"
                                                   , "succesfully created 3 GuardConditions", Test.Framework.TestVerdict.Pass, Test.Framework.TestVerdict.Pass);

            return(result);
        }
Example #10
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);
        }
 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);
 }
        public override Test.Framework.TestResult Run(Test.Framework.TestCase testCase)
        {
            DDS.DomainParticipantFactory factory;
            DDS.IDomainParticipant       participant;
            DDS.DomainParticipantQos     pqosHolder = null;
            DDS.TopicQos              topQosHolder  = null;
            DDS.ITopic                topic;
            mod.tstTypeSupport        typeSupport = null;
            Test.Framework.TestResult result;
            string name;
            string typeName;

            DDS.ReturnCode rc;
            result = new Test.Framework.TestResult("Initialization success", string.Empty, Test.Framework.TestVerdict
                                                   .Pass, Test.Framework.TestVerdict.Fail);
            factory = DDS.DomainParticipantFactory.Instance;
            if (factory == null)
            {
                result.Result = "DomainParticipantFactory could not be initialized.";
                return(result);
            }

            if (factory.GetDefaultParticipantQos(ref pqosHolder) != DDS.ReturnCode.Ok)
            {
                result.Result = "Default DomainParticipantQos could not be resolved.";
                return(result);
            }
            participant = factory.CreateParticipant(DDS.DomainId.Default, pqosHolder);//, null, 0);
            if (participant == null)
            {
                result.Result = "Creation of DomainParticipant failed.";
                return(result);
            }
            typeSupport = new mod.tstTypeSupport();
            if (typeSupport == null)
            {
                result.Result = "Creation of tstTypeSupport failed.";
                return(result);
            }
            name     = "my_topic";
            typeName = "my_type";
            rc       = typeSupport.RegisterType(participant, typeName);
            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(name, typeName, topQosHolder);//, null, 0);
            if (topic == null)
            {
                result.Result = "Topic could not be created.";
                return(result);
            }
            testCase.RegisterObject("factory", factory);
            testCase.RegisterObject("participantQos", pqosHolder);
            testCase.RegisterObject("participant", participant);
            testCase.RegisterObject("topic", topic);
            testCase.RegisterObject("topicQos", topQosHolder);
            testCase.RegisterObject("typeSupport", typeSupport);
            testCase.RegisterObject("topicName", name);
            testCase.RegisterObject("topicTypeName", typeName);
            result.Result  = "Initialization success.";
            result.Verdict = Test.Framework.TestVerdict.Pass;
            return(result);
        }
        public override Test.Framework.TestResult Run(Test.Framework.TestCase testCase)
        {
            DDS.DomainParticipantFactory factory;
            DDS.IDomainParticipant       participant;
            DDS.DomainParticipantQos     pqos   = null;
            DDS.SubscriberQos            subQos = null;
            DDS.ISubscriber           subscriber;
            DDS.PublisherQos          pubQos = null;
            DDS.IPublisher            publisher;
            mod.tstTypeSupport        typeSupport;
            DDS.TopicQos              tQos = null;
            DDS.ITopic                topic;
            DDS.DataReaderQos         drQos = null;
            mod.tstDataReader         datareader;
            DDS.DataWriterQos         dwQos = null;
            mod.tstDataWriter         datawriter;
            Test.Framework.TestResult result;
            DDS.ReturnCode            rc;
            result = new Test.Framework.TestResult("Initialization success", string.Empty, Test.Framework.TestVerdict
                                                   .Pass, Test.Framework.TestVerdict.Fail);
            factory = DDS.DomainParticipantFactory.Instance;
            if (factory == null)
            {
                result.Result = "DomainParticipantFactory could not be initialized.";
                return(result);
            }

            if (factory.GetDefaultParticipantQos(ref pqos) != DDS.ReturnCode.Ok)
            {
                result.Result = "Default DomainParticipantQos could not be resolved.";
                return(result);
            }
            participant = factory.CreateParticipant(DDS.DomainId.Default, pqos);//, null, 0);
            if (participant == null)
            {
                result.Result = "Creation of DomainParticipant failed.";
                return(result);
            }

            if (participant.GetDefaultSubscriberQos(ref subQos) != DDS.ReturnCode.Ok)
            {
                result.Result = "Default SubscriberQos could not be resolved.";
                return(result);
            }
            subscriber = participant.CreateSubscriber(subQos);//, null, 0);
            if (subscriber == null)
            {
                result.Result = "Subscriber could not be created.";
                return(result);
            }
            typeSupport = new mod.tstTypeSupport();
            rc          = typeSupport.RegisterType(participant, "tstType");
            if (rc != DDS.ReturnCode.Ok)
            {
                result.Result = "Typesupport could not be registered.";
                return(result);
            }

            if (participant.GetDefaultTopicQos(ref tQos) != DDS.ReturnCode.Ok)
            {
                result.Result = "Default TopicQos could not be resolved.";
                return(result);
            }

            topic = participant.CreateTopic("tst", "tstType", tQos);//, null, 0);
            if (topic == null)
            {
                result.Result = "Topic could not be created.";
                return(result);
            }
            if (participant.GetDefaultPublisherQos(ref pubQos) != DDS.ReturnCode.Ok)
            {
                result.Result = "Default PublisherQos could not be resolved.";
                return(result);
            }
            publisher = participant.CreatePublisher(pubQos);//, null, 0);
            if (publisher == null)
            {
                result.Result = "Publisher could not be created.";
                return(result);
            }

            if (subscriber.GetDefaultDataReaderQos(ref drQos) != DDS.ReturnCode.Ok)
            {
                result.Result = "Default DataReaderQos could not be resolved.";
                return(result);
            }
            datareader = (mod.tstDataReader)subscriber.CreateDataReader(topic, drQos);//, null, 0);
            if (datareader == null)
            {
                result.Result = "DataReader could not be created.";
                return(result);
            }

            if (publisher.GetDefaultDataWriterQos(ref dwQos) != DDS.ReturnCode.Ok)
            {
                result.Result = "Default DataWriterQos could not be resolved.";
                return(result);
            }
            datawriter = (mod.tstDataWriter)publisher.CreateDataWriter(topic, dwQos);//, null, 0);

            testCase.RegisterObject("factory", factory);
            testCase.RegisterObject("participantQos", pqos);
            testCase.RegisterObject("participant", participant);
            testCase.RegisterObject("topic", topic);
            testCase.RegisterObject("topicQos", tQos);
            testCase.RegisterObject("subscriber", subscriber);
            testCase.RegisterObject("subscriberQos", subQos);
            testCase.RegisterObject("datareader", datareader);
            testCase.RegisterObject("datareaderQos", drQos);
            testCase.RegisterObject("publisher", publisher);
            testCase.RegisterObject("publisherQos", pubQos);
            testCase.RegisterObject("datawriter", datawriter);
            testCase.RegisterObject("datawriterQos", dwQos);
            result.Result  = "Initialization success.";
            result.Verdict = Test.Framework.TestVerdict.Pass;
            return(result);
        }
Example #14
0
        public override Test.Framework.TestResult Run(Test.Framework.TestCase testCase)
        {
            DDS.DomainParticipantFactory factory;
            DDS.IDomainParticipant       participant;
            DDS.DomainParticipantQos     pqosHolder   = null;
            DDS.SubscriberQos            subQosHolder = null;
            DDS.DataReaderQos            drQosHolder  = null;
            DDS.ISubscriber           subscriber;
            DDS.PublisherQos          pubQosHolder = null;
            DDS.IPublisher            publisher;
            mod.tstTypeSupport        typeSupport;
            DDS.TopicQos              tQosHolder = null;
            DDS.ITopic                topic;
            DDS.DataWriterQos         dwQosHolder = null;
            mod.tstDataWriter         datawriter;
            Test.Framework.TestResult result;
            DDS.ReturnCode            rc;
            result = new Test.Framework.TestResult("Initialization success", string.Empty, Test.Framework.TestVerdict.Pass,
                                                   Test.Framework.TestVerdict.Fail);
            factory = DDS.DomainParticipantFactory.Instance;
            if (factory == null)
            {
                result.Result = "DomainParticipantFactory could not be initialized.";
                return(result);
            }

            if (factory.GetDefaultParticipantQos(ref pqosHolder) != DDS.ReturnCode.Ok)
            {
                result.Result = "Default DomainParticipantQos could not be resolved.";
                return(result);
            }
            participant = factory.CreateParticipant(string.Empty, pqosHolder);//, null, 0);
            if (participant == null)
            {
                result.Result = "Creation of DomainParticipant failed.";
                return(result);
            }

            if (participant.GetDefaultSubscriberQos(ref subQosHolder) != DDS.ReturnCode.Ok)
            {
                result.Result = "Default SubscriberQos could not be resolved.";
                return(result);
            }
            subQosHolder.Partition.Name    = new string[1];
            subQosHolder.Partition.Name[0] = "testPartition";
            subscriber = participant.CreateSubscriber(subQosHolder);//, null, 0);
            if (subscriber == null)
            {
                result.Result = "Subscriber could not be created.";
                return(result);
            }
            typeSupport = new mod.tstTypeSupport();
            rc          = typeSupport.RegisterType(participant, "tstType");
            if (rc != DDS.ReturnCode.Ok)
            {
                result.Result = "Typesupport could not be registered.";
                return(result);
            }

            if (participant.GetDefaultTopicQos(ref tQosHolder) != DDS.ReturnCode.Ok)
            {
                result.Result = "Default TopicQos could not be resolved.";
                return(result);
            }
            tQosHolder.Durability.Kind  = DDS.DurabilityQosPolicyKind.TransientDurabilityQos;
            tQosHolder.Reliability.Kind = DDS.ReliabilityQosPolicyKind.ReliableReliabilityQos;
            topic = participant.CreateTopic("tst", "tstType", tQosHolder);//, null, 0);
            if (topic == null)
            {
                result.Result = "Topic could not be created.";
                return(result);
            }

            if (participant.GetDefaultPublisherQos(ref pubQosHolder) != DDS.ReturnCode.Ok)
            {
                result.Result = "Default PublisherQos could not be resolved.";
                return(result);
            }
            pubQosHolder.Partition.Name    = new string[1];
            pubQosHolder.Partition.Name[0] = "testPartition";
            publisher = participant.CreatePublisher(pubQosHolder);//, null, 0);
            if (publisher == null)
            {
                result.Result = "Publisher could not be created.";
                return(result);
            }

            if (publisher.CopyFromTopicQos(ref dwQosHolder, tQosHolder) != DDS.ReturnCode.Ok)
            {
                result.Result = "Default DataWriterQos could not be resolved.";
                return(result);
            }
            dwQosHolder.WriterDataLifecycle.AutodisposeUnregisteredInstances = true;
            datawriter = (mod.tstDataWriter)publisher.CreateDataWriter(topic, dwQosHolder);//, null, 0);
            if (datawriter == null)
            {
                result.Result = "DataWriter could not be created.";
                return(result);
            }

            if (subscriber.CopyFromTopicQos(ref drQosHolder, tQosHolder) != DDS.ReturnCode.Ok)
            {
                result.Result = "Default DataReaderQos could not be resolved.";
                return(result);
            }
            drQosHolder.Durability.Kind = DDS.DurabilityQosPolicyKind.VolatileDurabilityQos;
            testCase.RegisterObject("factory", factory);
            testCase.RegisterObject("participantQos", pqosHolder);
            testCase.RegisterObject("participant", participant);
            testCase.RegisterObject("topic", topic);
            testCase.RegisterObject("topicQos", tQosHolder);
            testCase.RegisterObject("subscriber", subscriber);
            testCase.RegisterObject("subscriberQos", subQosHolder);
            testCase.RegisterObject("datareaderQos", drQosHolder);
            testCase.RegisterObject("publisher", publisher);
            testCase.RegisterObject("publisherQos", pubQosHolder);
            testCase.RegisterObject("datawriter", datawriter);
            testCase.RegisterObject("datawriterQos", dwQosHolder);
            result.Result  = "Initialization success.";
            result.Verdict = Test.Framework.TestVerdict.Pass;
            return(result);
        }
Example #15
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);
        }
Example #16
0
        public override Test.Framework.TestResult Run(Test.Framework.TestCase testCase)
        {
            DDS.DomainParticipantFactory factory;
            DDS.IDomainParticipant       participant;
            mod.tstTypeSupport           typeSupport;
            DDS.TopicQos              topicQos = null;
            DDS.ITopic                topic;
            DDS.DomainParticipantQos  pqos = null;
            DDS.ReturnCode            rc;
            Test.Framework.TestResult result;
            result = new Test.Framework.TestResult("Initialization success", string.Empty, Test.Framework.TestVerdict.Pass,
                                                   Test.Framework.TestVerdict.Fail);
            factory = DDS.DomainParticipantFactory.Instance;
            if (factory == null)
            {
                result.Result = "DomainParticipantFactory could not be initialized.";
                return(result);
            }

            if (factory.GetDefaultParticipantQos(ref pqos) != DDS.ReturnCode.Ok)
            {
                result.Result = "Default DomainParticipantQos could not be resolved.";
                return(result);
            }
            participant = factory.CreateParticipant(string.Empty, pqos);//, null, 0);
            if (participant == null)
            {
                result.Result = "Creation of DomainParticipant failed.";
                return(result);
            }
            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 topicQos) != DDS.ReturnCode.Ok)
            {
                result.Result = "participant.get_default_topic_qos failed.";
                return(result);
            }
            topic = participant.CreateTopic("my_topic", "my_type", topicQos);//, null, 0);
            if (topic == null)
            {
                result.Result = "participant.create_topic failed.";
                return(result);
            }
            testCase.RegisterObject("factory", factory);
            testCase.RegisterObject("participantQos", pqos);
            testCase.RegisterObject("participant", participant);
            testCase.RegisterObject("topic", topic);
            result.Result  = "Initialization success.";
            result.Verdict = Test.Framework.TestVerdict.Pass;
            return(result);
        }