Exemplo n.º 1
1
        /// <summary>
        /// Tests the initial default DataWriterQos and the getting and setting
        /// of the default DataWriterQos in the Publisher.
        /// </summary>
        /// <remarks>
        /// Tests the initial default DataWriterQos and the getting and setting
        /// of the default DataWriterQos in the Publisher.
        /// </remarks>
        public override Test.Framework.TestResult Run()
        {
            DDS.IPublisher publisher;
			DDS.DataWriterQos qos = null;
            string expResult = "DataWriterQos test succeeded";
            Test.Framework.TestResult result;
            DDS.ReturnCode rc;
            result = new Test.Framework.TestResult(expResult, string.Empty, Test.Framework.TestVerdict.Pass,
                Test.Framework.TestVerdict.Fail);
            publisher = (DDS.IPublisher)this.ResolveObject("publisher");

            if (publisher.GetDefaultDataWriterQos(ref qos) != DDS.ReturnCode.Ok)
            {
                result.Result = "Failed to get the default datawriter qos (1)";
                return result;
            }
            if (!test.sacs.QosComparer.DataWriterQosEquals(qos, test.sacs.QosComparer.defaultDataWriterQos
                ))
            {
                result.Result = "The default DataWriterQos != default (2)";
                return result;
            }
            qos.Deadline.Period.NanoSec = DDS.Duration.InfiniteNanoSec + 1;
            rc = publisher.SetDefaultDataWriterQos(qos);
            if (rc != DDS.ReturnCode.BadParameter)
            {
                result.Result = "Received return code " + rc + " but expected RETCODE_BAD_PARAMETER (3)";
                return result;
            }

            if (publisher.GetDefaultDataWriterQos(ref qos) != DDS.ReturnCode.Ok)
            {
                result.Result = "Failed to get the default datawriter qos (4)";
                return result;
            }
            if (!test.sacs.QosComparer.DataWriterQosEquals(qos, test.sacs.QosComparer.defaultDataWriterQos))
            {
                result.Result = "The default DataWriterQos != default (4)";
                return result;
            }
            qos.History.Depth = 8;
            qos.ResourceLimits.MaxSamplesPerInstance = 2;
            rc = publisher.SetDefaultDataWriterQos(qos);
            if (rc != DDS.ReturnCode.InconsistentPolicy)
            {
                result.Result = "Received return code " + rc + " but expected RETCODE_INCONSISTENT_POLICY (5)";
                return result;
            }
            result.Result = expResult;
            result.Verdict = Test.Framework.TestVerdict.Pass;
            return result;
        }
Exemplo n.º 2
0
        public override Test.Framework.TestResult Run()
        {
            DDS.ReturnCode rc;
            string         expResult = "unbounded string returns OK";

            Test.Framework.TestResult result = new Test.Framework.TestResult(
                expResult,
                string.Empty,
                Test.Framework.TestVerdict.Pass,
                Test.Framework.TestVerdict.Fail);

            bce.message      = new mod.boundsType();
            bce.message.name = "01234567890123456789012345678901234567890123456789" +
                               "01234567890123456789012345678901234567890123456789" +
                               "01234567890123456789012345678901234567890123456789" +
                               "01234567890123456789012345678901234567890123456789";
            rc = bce.datawriter.Write(bce.message, 0);
            if (rc != DDS.ReturnCode.Ok)
            {
                result.Result = "Unbounded string did NOT return OK.";
                return(result);
            }

            result.Result  = expResult;
            result.Verdict = Test.Framework.TestVerdict.Pass;
            return(result);
        }
Exemplo n.º 3
0
        public override Test.Framework.TestResult Run()
        {
            DDS.ReturnCode rc;
            string expResult = "struct array with too big size returns BAD_PARAMETER";
            Test.Framework.TestResult result = new Test.Framework.TestResult(
                expResult,
                string.Empty,
                Test.Framework.TestVerdict.Fail,
                Test.Framework.TestVerdict.Fail);

            if (result.Result != string.Empty)
            {
                return result;
            }

            bce.message2 = new mod.embeddedStructType();
            bce.message2.tstArr = new mod.tst[4];
            for (int i = 0; i < 4; i++) {
                bce.message2.tstArr[i] = new mod.tst(); // Prevent uninitialized array from causing error.
            }
            // scdds2162 - Once solved for CopyIn, re-enable the Write instruction.
            //rc = bce.datawriter2.Write(bce.message2, 0);
            rc = DDS.ReturnCode.Ok; // Temporary to make testcase FAIL. Please Remove when Write is re-enabled. 
            if (rc != DDS.ReturnCode.BadParameter)
            {
                result.Result = "struct array with too big size did NOT return BAD_PARAMETER.";
            	this.testFramework.TestMessage(Test.Framework.TestMessage.Note, "See scdds2162: CopyIn should do more validity checking.");
                return result;
            }
            result.Result = expResult;
            result.Verdict = Test.Framework.TestVerdict.Pass;
            return result;
        }
Exemplo n.º 4
0
        public override Test.Framework.TestResult Run()
        {
            DDS.ITopic topic;
            DDS.InconsistentTopicStatus status = new DDS.InconsistentTopicStatus();
            string expResult = "Topic status test succeeded";
            Test.Framework.TestResult result;
            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");

            rc = topic.GetInconsistentTopicStatus(ref status);
            if (rc != DDS.ReturnCode.Ok)
            {
                result.Result = "InconsistentTopicStatus could not be resolved.";
                return result;
            }
            if (status.TotalCount != 0)
            {
                result.Result = "InconsistentTopicStatus.TotalCount != 0.";
                return result;
            }
            if (status.TotalCountChange != 0)
            {
                result.Result = "InconsistentTopicStatus.TotalCountChange != 0.";
                return result;
            }
            result.Result = expResult;
            result.Verdict = Test.Framework.TestVerdict.Pass;
            return result;
        }
Exemplo n.º 5
0
        public override Test.Framework.TestResult Run()
        {
            Test.Framework.TestResult result;
            DDS.QosProvider qosProvider = null;
            DDS.DomainParticipantQos participantQos =
                test.sacs.QosComparer.defaultDomainParticipantQos;
            DDS.TopicQos topicQos =
                test.sacs.QosComparer.defaultTopicQos;
            DDS.SubscriberQos subscriberQos =
                test.sacs.QosComparer.defaultSubscriberQos;
            DDS.DataReaderQos readerQos =
                test.sacs.QosComparer.defaultDataReaderQos;
            DDS.PublisherQos publisherQos =
                test.sacs.QosComparer.defaultPublisherQos;
            DDS.DataWriterQos writerQos =
                test.sacs.QosComparer.defaultDataWriterQos;

            DDS.DomainParticipantQos xmlParticipantQos = new DDS.DomainParticipantQos ();
            DDS.TopicQos xmlTopicQos = new DDS.TopicQos ();
            DDS.SubscriberQos xmlSubscriberQos = new DDS.SubscriberQos ();
            DDS.DataReaderQos xmlReaderQos = new DDS.DataReaderQos ();
            DDS.PublisherQos xmlPublisherQos = new DDS.PublisherQos ();
            DDS.DataWriterQos xmlWriterQos = new DDS.DataWriterQos ();

            qosProvider = new DDS.QosProvider (this.uri, null);

            if (qosProvider.GetParticipantQos (ref xmlParticipantQos, null) != 0 ||
                qosProvider.GetTopicQos (ref xmlTopicQos, null) != 0 ||
                qosProvider.GetSubscriberQos (ref xmlSubscriberQos, null) != 0 ||
                qosProvider.GetDataReaderQos (ref xmlReaderQos, null) != 0 ||
                qosProvider.GetPublisherQos (ref xmlPublisherQos, null) != 0 ||
                qosProvider.GetDataWriterQos (ref xmlWriterQos, null) != 0)
            {
                result = new Test.Framework.TestResult (
                    "QosProvider should successfully parse XML file",
                    "QosProvider did not parse XML file " + uri,
                    Test.Framework.TestVerdict.Pass,
                    Test.Framework.TestVerdict.Fail);
            } else if (!QosComparer.DomainParticipantQosEquals (xmlParticipantQos, participantQos) ||
                       !QosComparer.TopicQosEquals (xmlTopicQos, topicQos) ||
                       !QosComparer.SubscriberQosEquals (xmlSubscriberQos, subscriberQos) ||
                       !QosComparer.DataReaderQosEquals (xmlReaderQos, readerQos) ||
                       !QosComparer.PublisherQosEquals (xmlPublisherQos, publisherQos) ||
                       !QosComparer.DataWriterQosEquals (xmlWriterQos, writerQos))
            {
                result = new Test.Framework.TestResult (
                    "QosProvider should successfully parse XML file",
                    "QosProvider did not correctly parse XML file " + uri,
                    Test.Framework.TestVerdict.Pass,
                    Test.Framework.TestVerdict.Fail);
            } else {
                result = new Test.Framework.TestResult (
                    "QosProvider should successfully parse XML file",
                    "QosProvider correctly parsed XML file " + uri,
                    Test.Framework.TestVerdict.Pass,
                    Test.Framework.TestVerdict.Pass);
            }

            return result;
        }
        public override Test.Framework.TestResult Run()
        {
            DDS.ReturnCode rc;
            string         expResult = "null pointer struct returns BAD_PARAMETER";

            Test.Framework.TestResult result = new Test.Framework.TestResult(
                expResult,
                string.Empty,
                Test.Framework.TestVerdict.Pass,
                Test.Framework.TestVerdict.Fail);

            if (result.Result != string.Empty)
            {
                return(result);
            }

            bce.message2        = new mod.embeddedStructType();
            bce.message2.tstStr = null;
            rc = bce.datawriter2.Write(bce.message2, 0);
            if (rc != DDS.ReturnCode.BadParameter)
            {
                result.Result = "null pointer struct did NOT return BAD_PARAMETER.";
                return(result);
            }
            result.Result  = expResult;
            result.Verdict = Test.Framework.TestVerdict.Pass;
            return(result);
        }
Exemplo n.º 7
0
        public override Test.Framework.TestResult Run()
        {
            DDS.ReturnCode rc;
            string         expResult = "out of bounds element in a sequence of string returns BAD_PARAMETER";

            Test.Framework.TestResult result = new Test.Framework.TestResult(
                expResult,
                string.Empty,
                Test.Framework.TestVerdict.Pass,
                Test.Framework.TestVerdict.Fail);

            bce.message            = new mod.boundsType();
            bce.message.strSeq2    = new string[2];
            bce.message.strSeq2[0] = "0";
            bce.message.strSeq2[1] = "123456";
            rc = bce.datawriter.Write(bce.message, 0);
            if (rc != DDS.ReturnCode.BadParameter)
            {
                result.Result = "out of bounds element in a sequence of string did NOT return BAD_PARAMETER.";
                return(result);
            }

            result.Result  = expResult;
            result.Verdict = Test.Framework.TestVerdict.Pass;
            return(result);
        }
        public override Test.Framework.TestResult Run()
        {
            DDS.ReturnCode rc;
            string         expResult = "de-initialization is successful";

            Test.Framework.TestResult result = new Test.Framework.TestResult(
                expResult,
                string.Empty,
                Test.Framework.TestVerdict.Pass,
                Test.Framework.TestVerdict.Fail);

            rc = bce.participant.DeleteContainedEntities();
            if (rc != DDS.ReturnCode.Ok)
            {
                result.Result = "delete_contained_entities failed.";
                return(result);
            }
            rc = bce.factory.DeleteParticipant(bce.participant);
            if (rc != DDS.ReturnCode.Ok)
            {
                result.Result = "delete_participant failed.";
                return(result);
            }
            result.Result  = expResult;
            result.Verdict = Test.Framework.TestVerdict.Pass;
            return(result);
        }
Exemplo n.º 9
0
        public override Test.Framework.TestResult Run()
        {
            DDS.ISubscriber subscriber;
            string          expResult = "Functions not supported yet.";

            Test.Framework.TestResult result;
            DDS.ReturnCode            rc;
            result = new Test.Framework.TestResult(expResult, string.Empty, Test.Framework.TestVerdict
                                                   .Pass, Test.Framework.TestVerdict.Fail);
            subscriber = (DDS.ISubscriber) this.ResolveObject("subscriber");
            subscriber.NotifyDataReaders();
            rc = subscriber.BeginAccess();
            if (rc != DDS.ReturnCode.Unsupported)
            {
                result.Result = "subscriber.begin_access has been implemented.";
                return(result);
            }
            rc = subscriber.EndAccess();
            if (rc != DDS.ReturnCode.Unsupported)
            {
                result.Result = "subscriber.end_access has been implemented.";
                return(result);
            }
            result.Result  = "Functions not supported yet.";
            result.Verdict = Test.Framework.TestVerdict.Pass;
            return(result);
        }
Exemplo n.º 10
0
        public override Test.Framework.TestResult Run()
        {
            DDS.IDataReader reader;
			DDS.DataReaderQos qos = null;
			DDS.DataReaderQos qos2 = null;
			DDS.DataReaderQos holder = null;
            DDS.ReturnCode rc;
            Test.Framework.TestResult result;
            string expResult = "Reader test succeeded.";
            result = new Test.Framework.TestResult(expResult, string.Empty, Test.Framework.TestVerdict.Pass,
                Test.Framework.TestVerdict.Fail);
            reader = (DDS.IDataReader)this.ResolveObject("datareader");
            qos = (DDS.DataReaderQos)this.ResolveObject("datareaderQos");

            if (reader.GetQos(ref holder) != DDS.ReturnCode.Ok)
            {
                result.Result = "Qos of DataReader could not be resolved.";
                return result;
            }
            if (!test.sacs.QosComparer.DataReaderQosEquals(holder, qos))
            {
                result.Result = "Qos of DataReader does not match provided qos.";
                return result;
            }
            if (!test.sacs.QosComparer.DataReaderQosEquals(holder, test.sacs.QosComparer.defaultDataReaderQos))
            {
                result.Result = "Qos of DataWriter does not match default qos.";
                return result;
            }
            qos2 = holder;
            qos2.Deadline.Period = new DDS.Duration(3, 3);
            qos2.LatencyBudget.Duration = new DDS.Duration(6, 6);
            qos2.ReaderDataLifecycle.AutopurgeDisposedSamplesDelay = new DDS.Duration(
                5, 5);
            qos2.ReaderDataLifecycle.EnableInvalidSamples = false;
            qos2.ReaderDataLifecycle.InvalidSampleVisibility.Kind = DDS.InvalidSampleVisibilityQosPolicyKind.MinimumInvalidSamples;
            qos2.UserData.Value = new byte[2];
            qos2.UserData.Value[0] = 2;
            qos2.UserData.Value[0] = 4;
            rc = reader.SetQos(qos2);
            if (rc != DDS.ReturnCode.Ok)
            {
                result.Result = "New Qos could not be applied.";
                return result;
            }

            if (reader.GetQos(ref holder) != DDS.ReturnCode.Ok)
            {
                result.Result = "Qos of DataReader could not be resolved (2).";
                return result;
            }
            if (!test.sacs.QosComparer.DataReaderQosEquals(holder, qos2))
            {
                result.Result = "Qos of DataReader does not match provided qos (2).";
                return result;
            }
            result.Result = expResult;
            result.Verdict = Test.Framework.TestVerdict.Pass;
            return result;
        }
Exemplo n.º 11
0
        public override Test.Framework.TestResult Run()
        {
            string expResult        = "ContentFilteredTopic test succeeded";
            string filteredTypeName = "m";
            string filterExpression = "long_1 < 10";

            DDS.IDomainParticipant    participant;
            DDS.ITopic                topic;
            DDS.IContentFilteredTopic filteredTopic;
            Test.Framework.TestResult result;
            result = new Test.Framework.TestResult(expResult, string.Empty, Test.Framework.TestVerdict.Pass,
                                                   Test.Framework.TestVerdict.Fail);
            participant   = (DDS.IDomainParticipant) this.ResolveObject("participant");
            topic         = (DDS.ITopic) this.ResolveObject("topic");
            filteredTopic = participant.CreateContentFilteredTopic(filteredTypeName, topic,
                                                                   filterExpression, null);
            if (filteredTopic == null)
            {
                result.Result = "participant.create_contentfilteredtopic failed (1).";
                return(result);
            }
            result.Result  = expResult;
            result.Verdict = Test.Framework.TestVerdict.Pass;
            return(result);
        }
Exemplo n.º 12
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);
        }
Exemplo n.º 13
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(string.Empty, 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;
        }
Exemplo n.º 14
0
 public override Test.Framework.TestResult Run()
 {
     DDS.IDomainParticipant participant1;
     DDS.IDomainParticipant lookedUpParticipant1;
     DDS.DomainParticipantFactory factory;
     Test.Framework.TestResult result = new Test.Framework.TestResult("lookup returns the same objects as where originally created"
         , "OK", Test.Framework.TestVerdict.Pass, Test.Framework.TestVerdict.Pass);
     factory = (DDS.DomainParticipantFactory)ResolveObject("theFactory");
     participant1 = (DDS.IDomainParticipant)ResolveObject("participant1");
     lookedUpParticipant1 = factory.LookupParticipant(string.Empty);
     if (participant1 != lookedUpParticipant1)
     {
         result.Result = "participant1 and lookedUpParticipant1 differ";
         result.Verdict = Test.Framework.TestVerdict.Fail;
         return result;
     }
     lookedUpParticipant1 = null;
     lookedUpParticipant1 = factory.LookupParticipant("file://rubbish");
     if (lookedUpParticipant1 != null)
     {
         result.Result = "lookup returned a participant after looking for a non existing participant";
         result.Verdict = Test.Framework.TestVerdict.Fail;
         return result;
     }
     lookedUpParticipant1 = null;
     lookedUpParticipant1 = factory.LookupParticipant(string.Empty);
     if (lookedUpParticipant1 != participant1)
     {
         result.Result = "lookup didn't return the expected participant";
         result.Verdict = Test.Framework.TestVerdict.Fail;
         return result;
     }
     return result;
 }
Exemplo n.º 15
0
 public override Test.Framework.TestResult Run()
 {
     string filterExpression = "long_1 < %99";
     string[] expressionParameters = new string[] { "1", "2", "3" };
     string expResult = "ContentFilteredTopic test succeeded";
     DDS.IDomainParticipant participant;
     DDS.ITopic topic;
     DDS.IContentFilteredTopic filteredTopic;
     Test.Framework.TestResult result;
     topic = (DDS.ITopic)this.ResolveObject("topic");
     participant = (DDS.IDomainParticipant)this.ResolveObject("participant");
     result = new Test.Framework.TestResult(expResult, string.Empty, Test.Framework.TestVerdict.Pass,
         Test.Framework.TestVerdict.Fail);
     filteredTopic = participant.CreateContentFilteredTopic("tc4_filtered_topic", topic
         , filterExpression, expressionParameters);
     if (filteredTopic != null)
     {
         System.Console.Out.WriteLine("NOTE\t\t: See STR/CP TH282");
         participant.DeleteContentFilteredTopic(filteredTopic);
         result.ExpectedVerdict = Test.Framework.TestVerdict.Fail;
         result.Result = "could create a ContentFilteredTopic which refers to non existing param %99";
         return result;
     }
     result.Result = expResult;
     result.Verdict = Test.Framework.TestVerdict.Pass;
     return result;
 }
Exemplo n.º 16
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;
 }
Exemplo n.º 17
0
        public override Test.Framework.TestResult Run()
        {
            mod.tstDataReader reader;
            mod.tstDataWriter writer;
            long handle;

            DDS.ReturnCode            rc;
            Test.Framework.TestResult result;
            string expResult = "reader::lookup_instance test succeeded.";

            result = new Test.Framework.TestResult(expResult, string.Empty, Test.Framework.TestVerdict.Pass,
                                                   Test.Framework.TestVerdict.Fail);
            reader = (mod.tstDataReader) this.ResolveObject("datareader");
            writer = (mod.tstDataWriter) this.ResolveObject("datawriter");
            mod.tst t = new mod.tst();
            t.long_1 = 1;
            t.long_2 = 1;
            t.long_3 = 1;

            rc = writer.Write(t);
            if (rc != DDS.ReturnCode.Ok)
            {
                result.Result = "write failed";
                return(result);
            }

            // lookup instance with writer...
            handle = writer.LookupInstance(t);
            if (handle == 0)
            {
                result.Result = "writer LookupInstance, result == HANDLE_NIL";
                return(result);
            }

            handle = reader.LookupInstance(t);
            if (handle == 0)
            {
                result.Result = "reader LookupInstance, result == HANDLE_NIL";
                return(result);
            }

            mod.tst[]        data = new mod.tst[0];
            DDS.SampleInfo[] info = new DDS.SampleInfo[0];
            rc = reader.ReadInstance(ref data, ref info, 1, handle, DDS.SampleStateKind.Any, DDS.ViewStateKind.Any,
                                     DDS.InstanceStateKind.Any);
            if (rc != DDS.ReturnCode.Ok)
            {
                result.Result = "read_instance failed";
                return(result);
            }
            if ((t.long_1 != data[0].long_1) || (t.long_2 != data[0].long_2) || (
                    t.long_3 != data[0].long_3))
            {
                result.Result = "incorrect data read";
                return(result);
            }
            result.Result  = expResult;
            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()
        {
            string filterExpression = "long_1 < %99";

            string[] expressionParameters = new string[] { "1", "2", "3" };
            string   expResult            = "ContentFilteredTopic test succeeded";

            DDS.IDomainParticipant    participant;
            DDS.ITopic                topic;
            DDS.IContentFilteredTopic filteredTopic;
            Test.Framework.TestResult result;
            topic       = (DDS.ITopic) this.ResolveObject("topic");
            participant = (DDS.IDomainParticipant) this.ResolveObject("participant");
            result      = new Test.Framework.TestResult(expResult, string.Empty, Test.Framework.TestVerdict.Pass,
                                                        Test.Framework.TestVerdict.Fail);
            filteredTopic = participant.CreateContentFilteredTopic("tc4_filtered_topic", topic
                                                                   , filterExpression, expressionParameters);
            if (filteredTopic != null)
            {
                this.testFramework.TestMessage(Test.Framework.TestMessage.Note, "See STR/CP TH282");
                this.testFramework.TestMessage(Test.Framework.TestMessage.Note, "See OSPL-2628: Query parameter checking should be added.");
                participant.DeleteContentFilteredTopic(filteredTopic);
                result.ExpectedVerdict = Test.Framework.TestVerdict.Fail;
                result.Result          = "could create a ContentFilteredTopic which refers to non existing param %99";
                return(result);
            }
            result.Result  = expResult;
            result.Verdict = Test.Framework.TestVerdict.Pass;
            return(result);
        }
Exemplo n.º 20
0
        public override Test.Framework.TestResult Run()
        {
            DDS.ReturnCode rc;
            string expResult = "struct array with correct size returns Ok";
            Test.Framework.TestResult result = new Test.Framework.TestResult(
                expResult,
                string.Empty,
                Test.Framework.TestVerdict.Pass,
                Test.Framework.TestVerdict.Fail);

            if (result.Result != string.Empty)
            {
                return result;
            }

            bce.message2 = new mod.embeddedStructType();
            bce.message2.tstArr = new mod.tst[3];
            for (int i = 0; i < 3; i++) {
                bce.message2.tstArr[i] = new mod.tst(); // Prevent uninitialized array from causing error.
            }
            rc = bce.datawriter2.Write(bce.message2, 0);
            if (rc != DDS.ReturnCode.Ok)
            {
                result.Result = "struct array with correct size did NOT return Ok.";
                return result;
            }
            result.Result = expResult;
            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(DDS.DomainId.Default, 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;
        }
Exemplo n.º 22
0
        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);
        }
Exemplo n.º 23
0
 public override Test.Framework.TestResult Run()
 {
     DDS.IDomainParticipant       participant1;
     DDS.IDomainParticipant       lookedUpParticipant1;
     DDS.DomainParticipantFactory factory;
     Test.Framework.TestResult    result = new Test.Framework.TestResult("lookup returns the same objects as where originally created"
                                                                         , "OK", Test.Framework.TestVerdict.Pass, Test.Framework.TestVerdict.Pass);
     factory              = (DDS.DomainParticipantFactory)ResolveObject("theFactory");
     participant1         = (DDS.IDomainParticipant)ResolveObject("participant1");
     lookedUpParticipant1 = factory.LookupParticipant(string.Empty);
     if (participant1 != lookedUpParticipant1)
     {
         result.Result  = "participant1 and lookedUpParticipant1 differ";
         result.Verdict = Test.Framework.TestVerdict.Fail;
         return(result);
     }
     lookedUpParticipant1 = null;
     lookedUpParticipant1 = factory.LookupParticipant("file://rubbish");
     if (lookedUpParticipant1 != null)
     {
         result.Result  = "lookup returned a participant after looking for a non existing participant";
         result.Verdict = Test.Framework.TestVerdict.Fail;
         return(result);
     }
     lookedUpParticipant1 = null;
     lookedUpParticipant1 = factory.LookupParticipant(string.Empty);
     if (lookedUpParticipant1 != participant1)
     {
         result.Result  = "lookup didn't return the expected participant";
         result.Verdict = Test.Framework.TestVerdict.Fail;
         return(result);
     }
     return(result);
 }
Exemplo n.º 24
0
		public override Test.Framework.TestResult Run()
		{
			DDS.ReturnCode rc;
			string expResult = "sequence of string bound violation returns BAD_PARAMETER";
            Test.Framework.TestResult result = new Test.Framework.TestResult(
                expResult, 
                string.Empty, 
                Test.Framework.TestVerdict.Pass, 
                Test.Framework.TestVerdict.Fail);

			bce.message = new mod.boundsType();
			bce.message.strSeq2 = new string[3];
			bce.message.strSeq2[0] = "0";
			bce.message.strSeq2[1] = "1";
			bce.message.strSeq2[2] = "2";
			rc = bce.datawriter.Write(bce.message, 0);
			if (rc != DDS.ReturnCode.BadParameter)
			{
				result.Result = "sequence of string bound violation did NOT return BAD_PARAMETER.";
				return result;
			}

			result.Result = expResult;
			result.Verdict = Test.Framework.TestVerdict.Pass;
			return result;
		}
Exemplo n.º 25
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);
 }
Exemplo n.º 26
0
		public override Test.Framework.TestResult Run()
		{
			DDS.ReturnCode rc;
			string expResult = "de-initialization is successful";
            Test.Framework.TestResult result = new Test.Framework.TestResult(
                expResult, 
                string.Empty, 
                Test.Framework.TestVerdict.Pass, 
                Test.Framework.TestVerdict.Fail);

			rc = bce.participant.DeleteContainedEntities();
			if (rc != DDS.ReturnCode.Ok)
			{
				result.Result = "delete_contained_entities failed.";
				return result;
			}
			rc = bce.factory.DeleteParticipant(bce.participant);
			if (rc != DDS.ReturnCode.Ok)
			{
				result.Result = "delete_participant failed.";
				return result;
			}
			result.Result = expResult;
			result.Verdict = Test.Framework.TestVerdict.Pass;
			return result;
		}
Exemplo n.º 27
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;
 }
Exemplo n.º 28
0
		public override Test.Framework.TestResult Run()
		{
			DDS.ReturnCode rc;
			string expResult = "unbounded string returns OK";
            Test.Framework.TestResult result = new Test.Framework.TestResult(
                expResult, 
                string.Empty, 
                Test.Framework.TestVerdict.Pass, 
                Test.Framework.TestVerdict.Fail);

			bce.message = new mod.boundsType();
			bce.message.name = "01234567890123456789012345678901234567890123456789" + 
			                   "01234567890123456789012345678901234567890123456789" +
			                   "01234567890123456789012345678901234567890123456789" +
			                   "01234567890123456789012345678901234567890123456789";
			rc = bce.datawriter.Write(bce.message, 0);
			if (rc != DDS.ReturnCode.Ok)
			{
				result.Result = "Unbounded string did NOT return OK.";
				return result;
			}

			result.Result = expResult;
			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;
        }
Exemplo n.º 30
0
        public override Test.Framework.TestResult Run()
        {
            DDS.ReturnCode rc;
            string         expResult = "struct array with too small size returns BAD_PARAMETER";

            Test.Framework.TestResult result = new Test.Framework.TestResult(
                expResult,
                string.Empty,
                Test.Framework.TestVerdict.Pass,
                Test.Framework.TestVerdict.Fail);

            if (result.Result != string.Empty)
            {
                return(result);
            }

            bce.message2        = new mod.embeddedStructType();
            bce.message2.tstArr = new mod.tst[2];
            for (int i = 0; i < 2; i++)
            {
                bce.message2.tstArr[i] = new mod.tst(); // Prevent uninitialized array from causing error.
            }
            rc = bce.datawriter2.Write(bce.message2, 0);
            if (rc != DDS.ReturnCode.BadParameter)
            {
                result.Result = "struct array with too small size did NOT return BAD_PARAMETER.";
                return(result);
            }
            result.Result  = expResult;
            result.Verdict = Test.Framework.TestVerdict.Pass;
            return(result);
        }
Exemplo n.º 31
0
        public override Test.Framework.TestResult Run()
        {
            DDS.ReturnCode rc;
            string expResult = "sequence of structs with length > bound returns BadParameter";
            Test.Framework.TestResult result = new Test.Framework.TestResult(
                expResult,
                string.Empty,
                Test.Framework.TestVerdict.Pass,
                Test.Framework.TestVerdict.Fail);

            if (result.Result != string.Empty)
            {
                return result;
            }

            bce.message2 = new mod.embeddedStructType();
            for (int i = 0; i < 3; i++) {
                bce.message2.tstArr[i] = new mod.tst(); // Prevent uninitialized array from causing error.
            }
            bce.message2.tstSeq = new mod.tst[4];
            for (int i = 0; i < 4; i++) {
                bce.message2.tstSeq[i] = new mod.tst(); // Prevent uninitialized sequence elements from causing error.
            }
            rc = bce.datawriter2.Write(bce.message2, 0);
            if (rc != DDS.ReturnCode.BadParameter)
            {
                result.Result = "sequence of structs with length > bound did NOT return BadParameter.";
                return result;
            }
            result.Result = expResult;
            result.Verdict = Test.Framework.TestVerdict.Pass;
            return result;
        }
Exemplo n.º 32
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;
 }
Exemplo n.º 33
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)
 {
     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);
 }
Exemplo n.º 36
0
        public override Test.Framework.TestResult Run()
        {
            DDS.IPublisher publisher;
			DDS.DataWriterQos dataWriterQos = null;
			DDS.DataWriterQos qosHolder1 = null;
            DDS.ITopic topic;
            string expResult = "copy_from_topic_qos rejects TOPIC_QOS_DEFAULT with correct code.";
            Test.Framework.TestResult result;
            DDS.ReturnCode rc = DDS.ReturnCode.Error;
            result = new Test.Framework.TestResult(expResult, string.Empty, Test.Framework.TestVerdict.Pass,
                Test.Framework.TestVerdict.Fail);
            publisher = (DDS.IPublisher)this.ResolveObject("publisher");
            topic = (DDS.ITopic)this.ResolveObject("topic");

            if (publisher.GetDefaultDataWriterQos(ref qosHolder1) != DDS.ReturnCode.Ok)
            {
                result.Result = "Could not retrieve default DataWriterQos";
                return result;
            }
            dataWriterQos = qosHolder1;
            dataWriterQos.History.Kind = DDS.HistoryQosPolicyKind.KeepAllHistoryQos;
            dataWriterQos.History.Depth = 150;

            // TODO: JLS, Verify the intent of this BadParameter test.
            DDS.TopicQos defaultTopicQos = null;
            rc = publisher.CopyFromTopicQos(ref qosHolder1, defaultTopicQos);
            if (rc != DDS.ReturnCode.BadParameter)
            {
                result.Result = "copy_from_topic_qos returns wrong code (RETCODE = " + rc + ").";
                return result;
            }
            result.Result = expResult;
            result.Verdict = Test.Framework.TestVerdict.Pass;
            return result;
        }
Exemplo n.º 37
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);
        }
Exemplo n.º 38
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);
        }
Exemplo n.º 39
0
        public override Test.Framework.TestResult Run()
        {
            DDS.ReturnCode rc;
            string         expResult = "struct array with too big size returns BAD_PARAMETER";

            Test.Framework.TestResult result = new Test.Framework.TestResult(
                expResult,
                string.Empty,
                Test.Framework.TestVerdict.Fail,
                Test.Framework.TestVerdict.Fail);

            if (result.Result != string.Empty)
            {
                return(result);
            }

            bce.message2        = new mod.embeddedStructType();
            bce.message2.tstArr = new mod.tst[4];
            for (int i = 0; i < 4; i++)
            {
                bce.message2.tstArr[i] = new mod.tst(); // Prevent uninitialized array from causing error.
            }
            // scdds2162 - Once solved for CopyIn, re-enable the Write instruction.
            //rc = bce.datawriter2.Write(bce.message2, 0);
            rc = DDS.ReturnCode.Ok; // Temporary to make testcase FAIL. Please Remove when Write is re-enabled.
            if (rc != DDS.ReturnCode.BadParameter)
            {
                result.Result = "struct array with too big size did NOT return BAD_PARAMETER.";
                this.testFramework.TestMessage(Test.Framework.TestMessage.Note, "See scdds2162: CopyIn should do more validity checking.");
                return(result);
            }
            result.Result  = expResult;
            result.Verdict = Test.Framework.TestVerdict.Pass;
            return(result);
        }
Exemplo n.º 40
0
 public override Test.Framework.TestResult Run()
 {
     DDS.ISubscriber subscriber;
     string expResult = "Functions not supported yet.";
     Test.Framework.TestResult result;
     DDS.ReturnCode rc;
     result = new Test.Framework.TestResult(expResult, string.Empty, Test.Framework.TestVerdict
         .Pass, Test.Framework.TestVerdict.Fail);
     subscriber = (DDS.ISubscriber)this.ResolveObject("subscriber");
     subscriber.NotifyDataReaders();
     rc = subscriber.BeginAccess();
     if (rc != DDS.ReturnCode.Unsupported)
     {
         result.Result = "subscriber.begin_access has been implemented.";
         return result;
     }
     rc = subscriber.EndAccess();
     if (rc != DDS.ReturnCode.Unsupported)
     {
         result.Result = "subscriber.end_access has been implemented.";
         return result;
     }
     result.Result = "Functions not supported yet.";
     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;
 }
Exemplo n.º 42
0
 public override Test.Framework.TestResult Run()
 {
     string expResult = "ContentFilteredTopic test succeeded";
     string[] expressionParameters;
     DDS.IDomainParticipant participant;
     DDS.ITopic topic;
     DDS.IContentFilteredTopic filteredTopic;
     Test.Framework.TestResult result;
     result = new Test.Framework.TestResult(expResult, string.Empty, Test.Framework.TestVerdict.Pass,
         Test.Framework.TestVerdict.Fail);
     topic = (DDS.ITopic)this.ResolveObject("topic");
     participant = (DDS.IDomainParticipant)this.ResolveObject("participant");
     expressionParameters = new string[102];
     Utils.FillStringArray(ref expressionParameters, "10");
     if (topic == null || participant == null)
     {
         System.Console.Error.WriteLine("participant or topic = null");
         result.Result = "precondition not met";
         return result;
     }
     expressionParameters[101] = "5";
     filteredTopic = participant.CreateContentFilteredTopic("filtered_topic", topic,
         "long_1 > %101", expressionParameters);
     if (filteredTopic != null)
     {
         System.Console.Out.WriteLine("NOTE\t\t: See STR/CP TH281");
         participant.DeleteContentFilteredTopic(filteredTopic);
         result.ExpectedVerdict = Test.Framework.TestVerdict.Fail;
         result.Result = "Could create a ContentFilteredTopic with an expression parameter %101 ";
         return result;
     }
     result.Result = expResult;
     result.Verdict = Test.Framework.TestVerdict.Pass;
     return result;
 }
Exemplo n.º 43
0
        public override Test.Framework.TestResult Run()
        {
            DDS.ReturnCode rc;
            string expResult = "null pointer struct returns BAD_PARAMETER";
            Test.Framework.TestResult result = new Test.Framework.TestResult(
                expResult,
                string.Empty,
                Test.Framework.TestVerdict.Pass,
                Test.Framework.TestVerdict.Fail);

            if (result.Result != string.Empty)
            {
                return result;
            }

            bce.message2 = new mod.embeddedStructType();
            bce.message2.tstStr = null;
            rc = bce.datawriter2.Write(bce.message2, 0);
            if (rc != DDS.ReturnCode.BadParameter)
            {
                result.Result = "null pointer struct did NOT return BAD_PARAMETER.";
                return result;
            }
            result.Result = expResult;
            result.Verdict = Test.Framework.TestVerdict.Pass;
            return result;
        }
Exemplo n.º 44
0
        public override Test.Framework.TestResult Run()
        {
            string filterExpression = "long_1 < %99";

            string[] expressionParameters = new string[] { "1", "2", "3" };
            string   expResult            = "ContentFilteredTopic test succeeded";

            DDS.IDomainParticipant    participant;
            DDS.ITopic                topic;
            DDS.IContentFilteredTopic filteredTopic;
            Test.Framework.TestResult result;
            topic       = (DDS.ITopic) this.ResolveObject("topic");
            participant = (DDS.IDomainParticipant) this.ResolveObject("participant");
            result      = new Test.Framework.TestResult(expResult, string.Empty, Test.Framework.TestVerdict.Pass,
                                                        Test.Framework.TestVerdict.Fail);
            filteredTopic = participant.CreateContentFilteredTopic("tc4_filtered_topic", topic
                                                                   , filterExpression, expressionParameters);
            if (filteredTopic != null)
            {
                System.Console.Out.WriteLine("NOTE\t\t: See STR/CP TH282");
                participant.DeleteContentFilteredTopic(filteredTopic);
                result.ExpectedVerdict = Test.Framework.TestVerdict.Fail;
                result.Result          = "could create a ContentFilteredTopic which refers to non existing param %99";
                return(result);
            }
            result.Result  = expResult;
            result.Verdict = Test.Framework.TestVerdict.Pass;
            return(result);
        }
Exemplo n.º 45
0
        public override Test.Framework.TestResult Run()
        {
            DDS.ITopic topic;
            DDS.InconsistentTopicStatus status = new DDS.InconsistentTopicStatus();
            string expResult = "Topic status test succeeded";

            Test.Framework.TestResult result;
            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");

            rc = topic.GetInconsistentTopicStatus(ref status);
            if (rc != DDS.ReturnCode.Ok)
            {
                result.Result = "InconsistentTopicStatus could not be resolved.";
                return(result);
            }
            if (status.TotalCount != 0)
            {
                result.Result = "InconsistentTopicStatus.TotalCount != 0.";
                return(result);
            }
            if (status.TotalCountChange != 0)
            {
                result.Result = "InconsistentTopicStatus.TotalCountChange != 0.";
                return(result);
            }
            result.Result  = expResult;
            result.Verdict = Test.Framework.TestVerdict.Pass;
            return(result);
        }
Exemplo n.º 46
0
        public override Test.Framework.TestResult Run()
        {
            DDS.IDataReader           reader;
            DDS.DataReaderQos         qos    = null;
            DDS.DataReaderQos         qos2   = null;
            DDS.DataReaderQos         holder = null;
            DDS.ReturnCode            rc;
            Test.Framework.TestResult result;
            string expResult = "Reader test succeeded.";

            result = new Test.Framework.TestResult(expResult, string.Empty, Test.Framework.TestVerdict.Pass,
                                                   Test.Framework.TestVerdict.Fail);
            reader = (DDS.IDataReader) this.ResolveObject("datareader");
            qos    = (DDS.DataReaderQos) this.ResolveObject("datareaderQos");

            if (reader.GetQos(ref holder) != DDS.ReturnCode.Ok)
            {
                result.Result = "Qos of DataReader could not be resolved.";
                return(result);
            }
            if (!test.sacs.QosComparer.DataReaderQosEquals(holder, qos))
            {
                result.Result = "Qos of DataReader does not match provided qos.";
                return(result);
            }
            if (!test.sacs.QosComparer.DataReaderQosEquals(holder, test.sacs.QosComparer.defaultDataReaderQos))
            {
                result.Result = "Qos of DataWriter does not match default qos.";
                return(result);
            }
            qos2 = holder;
            qos2.Deadline.Period        = new DDS.Duration(3, 3);
            qos2.LatencyBudget.Duration = new DDS.Duration(6, 6);
            qos2.ReaderDataLifecycle.AutopurgeDisposedSamplesDelay = new DDS.Duration(
                5, 5);
            qos2.UserData.Value    = new byte[2];
            qos2.UserData.Value[0] = 2;
            qos2.UserData.Value[0] = 4;
            rc = reader.SetQos(qos2);
            if (rc != DDS.ReturnCode.Ok)
            {
                result.Result = "New Qos could not be applied.";
                return(result);
            }

            if (reader.GetQos(ref holder) != DDS.ReturnCode.Ok)
            {
                result.Result = "Qos of DataReader could not be resolved (2).";
                return(result);
            }
            if (!test.sacs.QosComparer.DataReaderQosEquals(holder, qos2))
            {
                result.Result = "Qos of DataReader does not match provided qos (2).";
                return(result);
            }
            result.Result  = expResult;
            result.Verdict = Test.Framework.TestVerdict.Pass;
            return(result);
        }
Exemplo n.º 47
0
        public override Test.Framework.TestResult Run()
        {
            mod.tstDataReader reader;
            mod.tstDataWriter writer;
            long handle;

            DDS.ReturnCode rc;
            Test.Framework.TestResult result;
            string expResult = "reader::lookup_instance test succeeded.";
            result = new Test.Framework.TestResult(expResult, string.Empty, Test.Framework.TestVerdict.Pass,
                Test.Framework.TestVerdict.Fail);
            reader = (mod.tstDataReader)this.ResolveObject("datareader");
            writer = (mod.tstDataWriter)this.ResolveObject("datawriter");
            mod.tst t = new mod.tst();
            t.long_1 = 1;
            t.long_2 = 1;
            t.long_3 = 1;

            rc = writer.Write(t);
            if (rc != DDS.ReturnCode.Ok)
            {
                result.Result = "write failed";
                return result;
            }

            // lookup instance with writer...
            handle = writer.LookupInstance(t);
            if (handle == 0)
            {
                result.Result = "writer LookupInstance, result == HANDLE_NIL";
                return result;
            }

            handle = reader.LookupInstance(t);
            if (handle == 0)
            {
                result.Result = "reader LookupInstance, result == HANDLE_NIL";
                return result;
            }

            mod.tst[] data = new mod.tst[0];
            DDS.SampleInfo[] info = new DDS.SampleInfo[0];
            rc = reader.ReadInstance(ref data, ref info, 1, handle, DDS.SampleStateKind.Any, DDS.ViewStateKind.Any,
                DDS.InstanceStateKind.Any);
            if (rc != DDS.ReturnCode.Ok)
            {
                result.Result = "read_instance failed";
                return result;
            }
            if ((t.long_1 != data[0].long_1) || (t.long_2 != data[0].long_2) || (
                t.long_3 != data[0].long_3))
            {
                result.Result = "incorrect data read";
                return result;
            }
            result.Result = expResult;
            result.Verdict = Test.Framework.TestVerdict.Pass;
            return result;
        }
Exemplo n.º 48
0
        public override Test.Framework.TestResult Run()
        {
            DDS.IDataWriter writer;
            DDS.DataWriterQos qos;
            DDS.DataWriterQos qos2;
			DDS.DataWriterQos holder = null;
            DDS.ReturnCode rc;
            Test.Framework.TestResult result;
            string expResult = "Writer test succeeded.";
            result = new Test.Framework.TestResult(expResult, string.Empty, Test.Framework.TestVerdict
                .Pass, Test.Framework.TestVerdict.Fail);
            writer = (DDS.IDataWriter)this.ResolveObject("datawriter");
            qos = (DDS.DataWriterQos)this.ResolveObject("datawriterQos");

            if (writer.GetQos(ref holder) != DDS.ReturnCode.Ok)
            {
                result.Result = "Qos of DataWriter could not be resolved.";
                return result;
            }
            if (!test.sacs.QosComparer.DataWriterQosEquals(holder, qos))
            {
                result.Result = "Qos of DataWriter does not match provided qos.";
                return result;
            }
            if (!test.sacs.QosComparer.DataWriterQosEquals(holder, test.sacs.QosComparer.defaultDataWriterQos))
            {
                result.Result = "Qos of DataWriter does not match default qos.";
                return result;
            }
            qos2 = holder;
            qos2.Deadline.Period = new DDS.Duration(3, 3);
            qos2.LatencyBudget.Duration = new DDS.Duration(6, 6);
            qos2.Lifespan.Duration = new DDS.Duration(9, 9);
            qos2.OwnershipStrength.Value = 22;
            qos2.UserData.Value = new byte[2];
            qos2.UserData.Value[0] = 2;
            qos2.UserData.Value[0] = 4;
            rc = writer.SetQos(qos2);
            if (rc != DDS.ReturnCode.Ok)
            {
                result.Result = "New Qos could not be applied.";
                return result;
            }

            if (writer.GetQos(ref holder) != DDS.ReturnCode.Ok)
            {
                result.Result = "Qos of DataWriter could not be resolved (2).";
                return result;
            }
            if (!test.sacs.QosComparer.DataWriterQosEquals(holder, qos2))
            {
                result.Result = "Qos of DataWriter does not match provided qos (2).";
                return result;
            }
            result.Result = expResult;
            result.Verdict = Test.Framework.TestVerdict.Pass;
            return result;
        }
Exemplo n.º 49
0
        public override Test.Framework.TestResult Run()
        {
            Test.Framework.TestResult  result;
            Test.Framework.TestVerdict expVerdict = Test.Framework.TestVerdict.Pass;
            string expResult = "type is registered.";

            DDS.DomainParticipantFactory factory;
            DDS.IDomainParticipant       participant;
            DDS.DomainParticipantQos     pqosHolder = null;
            mod.tstTypeSupport           typesupport;
            DDS.ReturnCode returnCode;
            factory = DDS.DomainParticipantFactory.Instance;
            if (factory == null)
            {
                result = new Test.Framework.TestResult(expResult, "DomainParticipantFactory could not be initialised."
                                                       , expVerdict, Test.Framework.TestVerdict.Fail);
                return(result);
            }

            if (factory.GetDefaultParticipantQos(ref pqosHolder) != DDS.ReturnCode.Ok)
            {
                result = new Test.Framework.TestResult(expResult, "Default DomainParticipantQos could not be resolved."
                                                       , expVerdict, Test.Framework.TestVerdict.Fail);
                return(result);
            }
            participant = factory.CreateParticipant(string.Empty, pqosHolder);//, null, 0);
            if (participant == null)
            {
                result = new Test.Framework.TestResult(expResult, "Creation of DomainParticipant failed."
                                                       , expVerdict, Test.Framework.TestVerdict.Fail);
                return(result);
            }
            typesupport = new mod.tstTypeSupport();
            if (typesupport == null)
            {
                result = new Test.Framework.TestResult(expResult, "TypeSupport is not constructed."
                                                       , expVerdict, Test.Framework.TestVerdict.Fail);
                return(result);
            }
            returnCode = typesupport.RegisterType(participant, "mod::tst");
            if (returnCode != DDS.ReturnCode.Ok)
            {
                result = new Test.Framework.TestResult(expResult, "TypeSupport is not registered."
                                                       , expVerdict, Test.Framework.TestVerdict.Fail);
                return(result);
            }
            returnCode = factory.DeleteParticipant(participant);
            if (returnCode != DDS.ReturnCode.Ok)
            {
                result = new Test.Framework.TestResult(expResult, "Deletion of DomainParticipant failed."
                                                       , expVerdict, Test.Framework.TestVerdict.Fail);
                return(result);
            }
            result = new Test.Framework.TestResult(expResult, expResult, expVerdict, expVerdict
                                                   );
            return(result);
        }
Exemplo n.º 50
0
        public override Test.Framework.TestResult Run()
        {
            Test.Framework.TestResult result;
            Test.Framework.TestVerdict expVerdict = Test.Framework.TestVerdict.Pass;
            string expResult = "type is registered.";
            DDS.DomainParticipantFactory factory;
            DDS.IDomainParticipant participant;
            DDS.DomainParticipantQos pqosHolder = null;
            mod.tstTypeSupport typesupport;
            DDS.ReturnCode returnCode;
            factory = DDS.DomainParticipantFactory.Instance;
            if (factory == null)
            {
                result = new Test.Framework.TestResult(expResult, "DomainParticipantFactory could not be initialised."
                    , expVerdict, Test.Framework.TestVerdict.Fail);
                return result;
            }

            if (factory.GetDefaultParticipantQos(ref pqosHolder) != DDS.ReturnCode.Ok)
            {
                result = new Test.Framework.TestResult(expResult, "Default DomainParticipantQos could not be resolved."
                    , expVerdict, Test.Framework.TestVerdict.Fail);
                return result;
            }
            participant = factory.CreateParticipant(string.Empty, pqosHolder);//, null, 0);
            if (participant == null)
            {
                result = new Test.Framework.TestResult(expResult, "Creation of DomainParticipant failed."
                    , expVerdict, Test.Framework.TestVerdict.Fail);
                return result;
            }
            typesupport = new mod.tstTypeSupport();
            if (typesupport == null)
            {
                result = new Test.Framework.TestResult(expResult, "TypeSupport is not constructed."
                    , expVerdict, Test.Framework.TestVerdict.Fail);
                return result;
            }
            returnCode = typesupport.RegisterType(participant, "mod::tst");
            if (returnCode != DDS.ReturnCode.Ok)
            {
                result = new Test.Framework.TestResult(expResult, "TypeSupport is not registered."
                    , expVerdict, Test.Framework.TestVerdict.Fail);
                return result;
            }
            returnCode = factory.DeleteParticipant(participant);
            if (returnCode != DDS.ReturnCode.Ok)
            {
                result = new Test.Framework.TestResult(expResult, "Deletion of DomainParticipant failed."
                    , expVerdict, Test.Framework.TestVerdict.Fail);
                return result;
            }
            result = new Test.Framework.TestResult(expResult, expResult, expVerdict, expVerdict
                );
            return result;
        }
Exemplo n.º 51
0
        public override Test.Framework.TestResult Run()
        {
            DDS.ISubscriber   subscriber;
            DDS.DataReaderQos dataReaderQos;
            DDS.DataReaderQos qosHolder1 = null;
            DDS.DataReaderQos qosHolder2 = null;
            DDS.IDataReader   reader;
            DDS.ITopic        topic;
            string            expResult = "Default DataReadearQos is used when DATAREADER_QOS_DEFAULT is specified.";

            Test.Framework.TestResult result;
            DDS.ReturnCode            rc;
            result = new Test.Framework.TestResult(expResult, string.Empty, Test.Framework.TestVerdict
                                                   .Pass, Test.Framework.TestVerdict.Fail);
            subscriber = (DDS.ISubscriber) this.ResolveObject("subscriber");
            topic      = (DDS.ITopic) this.ResolveObject("topic");

            if (subscriber.GetDefaultDataReaderQos(ref qosHolder1) != DDS.ReturnCode.Ok)
            {
                result.Result = "Could not retrieve default DataReaderQos";
                return(result);
            }

            dataReaderQos = qosHolder1;
            dataReaderQos.History.Kind  = DDS.HistoryQosPolicyKind.KeepAllHistoryQos;
            dataReaderQos.History.Depth = 150;
            subscriber.SetDefaultDataReaderQos(dataReaderQos);

            reader = subscriber.CreateDataReader(topic);
            if (reader == null)
            {
                result.Result = "Could not create a DataReader.";
                return(result);
            }

            if (reader.GetQos(ref qosHolder2) != DDS.ReturnCode.Ok)
            {
                result.Result = "Could not retrieve DataReader qos";
                return(result);
            }

            if (!test.sacs.QosComparer.DataReaderQosEquals(qosHolder1, qosHolder2))
            {
                result.Result = "Default DataReadearQos is not used when DATAREADER_QOS_DEFAULT is specified." + qosHolder2.History.Kind + "  ::  " + qosHolder1.History.Kind;
                return(result);
            }
            rc = subscriber.DeleteDataReader(reader);
            if (rc != DDS.ReturnCode.Ok)
            {
                result.Result = "Could not delete a DataReader (RETCODE = " + rc + ").";
                return(result);
            }
            result.Result  = expResult;
            result.Verdict = Test.Framework.TestVerdict.Pass;
            return(result);
        }
Exemplo n.º 52
0
        public override Test.Framework.TestResult Run()
        {
            DDS.IPublisher    publisher;
            DDS.DataWriterQos dataWriterQos = null;
            DDS.DataWriterQos qosHolder1    = null;
            DDS.DataWriterQos qosHolder2    = null;
            DDS.IDataWriter   writer        = null;
            DDS.ITopic        topic;
            string            expResult = "Default DataWriterQos is used when DATAWRITER_QOS_DEFAULT is specified.";

            Test.Framework.TestResult result;
            DDS.ReturnCode            rc;
            result = new Test.Framework.TestResult(expResult, string.Empty, Test.Framework.TestVerdict.Pass,
                                                   Test.Framework.TestVerdict.Fail);
            publisher = (DDS.IPublisher) this.ResolveObject("publisher");
            topic     = (DDS.ITopic) this.ResolveObject("topic");

            if (publisher.GetDefaultDataWriterQos(ref qosHolder1) != DDS.ReturnCode.Ok)
            {
                result.Result = "Could not retrieve default DataWriterQos";
                return(result);
            }
            dataWriterQos = qosHolder1;
            dataWriterQos.History.Kind  = DDS.HistoryQosPolicyKind.KeepAllHistoryQos;
            dataWriterQos.History.Depth = 150;
            publisher.SetDefaultDataWriterQos(dataWriterQos);

            //TODO: JLS, DDS.DataWriterQos.Default does not exist
            writer = publisher.CreateDataWriter(topic, qosHolder1);
            if (writer == null)
            {
                result.Result = "Could not create a DataWriter.";
                return(result);
            }

            if (writer.GetQos(ref qosHolder2) != DDS.ReturnCode.Ok)
            {
                result.Result = "Could not retrieve DataWriter qos";
                return(result);
            }
            if (!test.sacs.QosComparer.DataWriterQosEquals(qosHolder1, qosHolder2))
            {
                result.Result = "Default DataWriterQos is not used when DATAWRITER_QOS_DEFAULT is specified.";
                return(result);
            }
            rc = publisher.DeleteDataWriter(writer);
            if (rc != DDS.ReturnCode.Ok)
            {
                result.Result = "Could not delete a DataWriter (RETCODE = " + rc + ").";
                return(result);
            }
            result.Result  = expResult;
            result.Verdict = Test.Framework.TestVerdict.Pass;
            return(result);
        }
Exemplo n.º 53
0
        public override Test.Framework.TestResult Run()
        {
            DDS.ISubscriber subscriber;
            DDS.DataReaderQos dataReaderQos;
			DDS.DataReaderQos qosHolder1 = null;
			DDS.DataReaderQos qosHolder2 = null;
            DDS.IDataReader reader;
            DDS.ITopic topic;
            string expResult = "Default DataReadearQos is used when DATAREADER_QOS_DEFAULT is specified.";
            Test.Framework.TestResult result;
            DDS.ReturnCode rc;
            result = new Test.Framework.TestResult(expResult, string.Empty, Test.Framework.TestVerdict
                .Pass, Test.Framework.TestVerdict.Fail);
            subscriber = (DDS.ISubscriber)this.ResolveObject("subscriber");
            topic = (DDS.ITopic)this.ResolveObject("topic");

            if (subscriber.GetDefaultDataReaderQos(ref qosHolder1) != DDS.ReturnCode.Ok)
            {
                result.Result = "Could not retrieve default DataReaderQos";
                return result;
            }

            dataReaderQos = qosHolder1;
            dataReaderQos.History.Kind = DDS.HistoryQosPolicyKind.KeepAllHistoryQos;
            dataReaderQos.History.Depth = 150;
            subscriber.SetDefaultDataReaderQos(dataReaderQos);

            reader = subscriber.CreateDataReader(topic);
            if (reader == null)
            {
                result.Result = "Could not create a DataReader.";
                return result;
            }

            if (reader.GetQos(ref qosHolder2) != DDS.ReturnCode.Ok)
            {
                result.Result = "Could not retrieve DataReader qos";
                return result;
            }
            
            if (!test.sacs.QosComparer.DataReaderQosEquals(qosHolder1, qosHolder2))
            {
                result.Result = "Default DataReadearQos is not used when DATAREADER_QOS_DEFAULT is specified." + qosHolder2.History.Kind + "  ::  " + qosHolder1.History.Kind;
                return result;
            }
            rc = subscriber.DeleteDataReader(reader);
            if (rc != DDS.ReturnCode.Ok)
            {
                result.Result = "Could not delete a DataReader (RETCODE = " + rc + ").";
                return result;
            }
            result.Result = expResult;
            result.Verdict = Test.Framework.TestVerdict.Pass;
            return result;
        }
Exemplo n.º 54
0
        public override Test.Framework.TestResult Run()
        {
            DDS.IDataReader                 reader;
            DDS.ITopicDescription           topic;
            DDS.ITopicDescription           topic2;
            DDS.ISubscriber                 subscriber;
            DDS.ISubscriber                 subscriber2;
            Test.Framework.TestResult       result;
            DDS.InstanceHandle[]            handles = null;
            DDS.PublicationBuiltinTopicData data    = null;
            DDS.ReturnCode rc;
            string         expResult = "All Functions supported.";

            result = new Test.Framework.TestResult(expResult, string.Empty, Test.Framework.TestVerdict.Pass,
                                                   Test.Framework.TestVerdict.Fail);
            reader     = (DDS.IDataReader) this.ResolveObject("datareader");
            topic      = (DDS.ITopicDescription) this.ResolveObject("topic");
            subscriber = (DDS.ISubscriber) this.ResolveObject("subscriber");
            topic2     = reader.GetTopicDescription();
            if (topic != topic2)
            {
                result.Result = "get_topicdescription resolved wrong topic.";
                return(result);
            }
            subscriber2 = reader.Subscriber;
            if (subscriber != subscriber2)
            {
                result.Result = "get_subscriber resolved wrong subscriber.";
                return(result);
            }
            rc = reader.WaitForHistoricalData(new DDS.Duration(3, 0));
            if (rc != DDS.ReturnCode.Ok)
            {
                result.Result = "wait_for_historical_data failed.";
                return(result);
            }
            rc = reader.GetMatchedPublications(ref handles);
            if (rc != DDS.ReturnCode.Ok || handles.Length != 1)
            {
                result.Result = "get_matched_publications failed.";
                return(result);
            }
            else
            {
                rc = reader.GetMatchedPublicationData(ref data, handles[0]);
                if (rc != DDS.ReturnCode.Ok)
                {
                    result.Result = "get_matched_publication_data failed.";
                    return(result);
                }
            }
            result.Result  = expResult;
            result.Verdict = Test.Framework.TestVerdict.Pass;
            return(result);
        }
Exemplo n.º 55
0
        public override Test.Framework.TestResult Run()
        {
            DDS.IDataReader reader;
            DDS.ITopicDescription topic;
            DDS.ITopicDescription topic2;
            DDS.ISubscriber subscriber;
            DDS.ISubscriber subscriber2;
            Test.Framework.TestResult result;
			DDS.InstanceHandle[] handles = null;
			DDS.PublicationBuiltinTopicData data = null;
            DDS.ReturnCode rc;
            string expResult = "All Functions supported.";
            result = new Test.Framework.TestResult(expResult, string.Empty, Test.Framework.TestVerdict.Pass,
                Test.Framework.TestVerdict.Fail);
            reader = (DDS.IDataReader)this.ResolveObject("datareader");
            topic = (DDS.ITopicDescription)this.ResolveObject("topic");
            subscriber = (DDS.ISubscriber)this.ResolveObject("subscriber");
            topic2 = reader.GetTopicDescription();
            if (topic != topic2)
            {
                result.Result = "get_topicdescription resolved wrong topic.";
                return result;
            }
            subscriber2 = reader.Subscriber;
            if (subscriber != subscriber2)
            {
                result.Result = "get_subscriber resolved wrong subscriber.";
                return result;
            }
            rc = reader.WaitForHistoricalData(new DDS.Duration(3, 0));
            if (rc != DDS.ReturnCode.Ok)
            {
                result.Result = "wait_for_historical_data failed.";
                return result;
            }
            rc = reader.GetMatchedPublications(ref handles);
            if (rc != DDS.ReturnCode.Ok || handles.Length != 1)
            {
                result.Result = "get_matched_publications failed.";
                return result;
            } 
            else 
            {
	            rc = reader.GetMatchedPublicationData(ref data, handles[0]);
	            if (rc != DDS.ReturnCode.Ok)
	            {
	                result.Result = "get_matched_publication_data failed.";
	                return result;
	            }
	        }
            result.Result = expResult;
            result.Verdict = Test.Framework.TestVerdict.Pass;
            return result;
        }
Exemplo n.º 56
0
        public override Test.Framework.TestResult Run()
        {
            DDS.IPublisher publisher;
			DDS.DataWriterQos dataWriterQos = null;
			DDS.DataWriterQos qosHolder1 = null;
			DDS.DataWriterQos qosHolder2 = null;
            DDS.IDataWriter writer = null;
            DDS.ITopic topic;
            string expResult = "Default DataWriterQos is used when DATAWRITER_QOS_DEFAULT is specified.";
            Test.Framework.TestResult result;
            DDS.ReturnCode rc;
            result = new Test.Framework.TestResult(expResult, string.Empty, Test.Framework.TestVerdict.Pass,
                Test.Framework.TestVerdict.Fail);
            publisher = (DDS.IPublisher)this.ResolveObject("publisher");
            topic = (DDS.ITopic)this.ResolveObject("topic");

            if (publisher.GetDefaultDataWriterQos(ref qosHolder1) != DDS.ReturnCode.Ok)
            {
                result.Result = "Could not retrieve default DataWriterQos";
                return result;
            }
            dataWriterQos = qosHolder1;
            dataWriterQos.History.Kind = DDS.HistoryQosPolicyKind.KeepAllHistoryQos;
            dataWriterQos.History.Depth = 150;
            publisher.SetDefaultDataWriterQos(dataWriterQos);

            //TODO: JLS, DDS.DataWriterQos.Default does not exist
            writer = publisher.CreateDataWriter(topic, qosHolder1);
            if (writer == null)
            {
                result.Result = "Could not create a DataWriter.";
                return result;
            }

            if (writer.GetQos(ref qosHolder2) != DDS.ReturnCode.Ok)
            {
                result.Result = "Could not retrieve DataWriter qos";
                return result;
            }
            if (!test.sacs.QosComparer.DataWriterQosEquals(qosHolder1, qosHolder2))
            {
                result.Result = "Default DataWriterQos is not used when DATAWRITER_QOS_DEFAULT is specified.";
                return result;
            }
            rc = publisher.DeleteDataWriter(writer);
            if (rc != DDS.ReturnCode.Ok)
            {
                result.Result = "Could not delete a DataWriter (RETCODE = " + rc + ").";
                return result;
            }
            result.Result = expResult;
            result.Verdict = Test.Framework.TestVerdict.Pass;
            return result;
        }
Exemplo n.º 57
0
        /// <summary>
        /// Tests the initial default DataWriterQos and the getting and setting
        /// of the default DataWriterQos in the Publisher.
        /// </summary>
        /// <remarks>
        /// Tests the initial default DataWriterQos and the getting and setting
        /// of the default DataWriterQos in the Publisher.
        /// </remarks>
        public override Test.Framework.TestResult Run()
        {
            DDS.IPublisher    publisher;
            DDS.DataWriterQos qos       = null;
            string            expResult = "DataWriterQos test succeeded";

            Test.Framework.TestResult result;
            DDS.ReturnCode            rc;
            result = new Test.Framework.TestResult(expResult, string.Empty, Test.Framework.TestVerdict.Pass,
                                                   Test.Framework.TestVerdict.Fail);
            publisher = (DDS.IPublisher) this.ResolveObject("publisher");

            if (publisher.GetDefaultDataWriterQos(ref qos) != DDS.ReturnCode.Ok)
            {
                result.Result = "Failed to get the default datawriter qos (1)";
                return(result);
            }
            if (!test.sacs.QosComparer.DataWriterQosEquals(qos, test.sacs.QosComparer.defaultDataWriterQos
                                                           ))
            {
                result.Result = "The default DataWriterQos != default (2)";
                return(result);
            }
            qos.Deadline.Period.NanoSec = DDS.Duration.InfiniteNanoSec + 1;
            rc = publisher.SetDefaultDataWriterQos(qos);
            if (rc != DDS.ReturnCode.BadParameter)
            {
                result.Result = "Received return code " + rc + " but expected RETCODE_BAD_PARAMETER (3)";
                return(result);
            }

            if (publisher.GetDefaultDataWriterQos(ref qos) != DDS.ReturnCode.Ok)
            {
                result.Result = "Failed to get the default datawriter qos (4)";
                return(result);
            }
            if (!test.sacs.QosComparer.DataWriterQosEquals(qos, test.sacs.QosComparer.defaultDataWriterQos))
            {
                result.Result = "The default DataWriterQos != default (4)";
                return(result);
            }
            qos.History.Depth = 8;
            qos.ResourceLimits.MaxSamplesPerInstance = 2;
            rc = publisher.SetDefaultDataWriterQos(qos);
            if (rc != DDS.ReturnCode.InconsistentPolicy)
            {
                result.Result = "Received return code " + rc + " but expected RETCODE_INCONSISTENT_POLICY (5)";
                return(result);
            }
            result.Result  = expResult;
            result.Verdict = Test.Framework.TestVerdict.Pass;
            return(result);
        }
Exemplo n.º 58
0
        public override Test.Framework.TestResult Run()
        {
            DDS.IDataWriter                  writer;
            DDS.ITopic                       topic;
            DDS.ITopic                       topic2;
            DDS.IPublisher                   publisher;
            DDS.IPublisher                   publisher2;
            DDS.InstanceHandle[]             handles;
            DDS.SubscriptionBuiltinTopicData data = null;
            Test.Framework.TestResult        result;
            DDS.ReturnCode                   rc;
            string expResult = "All Functions supported.";

            result = new Test.Framework.TestResult(expResult, string.Empty, Test.Framework.TestVerdict
                                                   .Pass, Test.Framework.TestVerdict.Fail);
            writer    = (DDS.IDataWriter) this.ResolveObject("datawriter");
            topic     = (DDS.ITopic) this.ResolveObject("topic");
            publisher = (DDS.IPublisher) this.ResolveObject("publisher");
            topic2    = writer.Topic;
            if (topic != topic2)
            {
                result.Result = "get_topic resolved wrong topic.";
                return(result);
            }
            publisher2 = writer.Publisher;
            if (publisher != publisher2)
            {
                result.Result = "get_publisher resolved wrong publisher.";
                return(result);
            }
            writer.AssertLiveliness();
            System.Threading.Thread.Sleep(1000); // Give writer some time to discover reader.
            handles = new DDS.InstanceHandle[0];
            rc      = writer.GetMatchedSubscriptions(ref handles);
            if (rc != DDS.ReturnCode.Ok || handles.Length != 1)
            {
                result.Result = "get_matched_subscriptions failed.";
                return(result);
            }
            else
            {
                rc = writer.GetMatchedSubscriptionData(ref data, handles[0]);
                if (rc != DDS.ReturnCode.Ok)
                {
                    result.Result = "get_matched_subscription_data failed.";
                    return(result);
                }
            }
            result.Result  = expResult;
            result.Verdict = Test.Framework.TestVerdict.Pass;
            return(result);
        }
Exemplo n.º 59
0
        public override Test.Framework.TestResult Run()
        {
            Test.Framework.TestResult  result;
            Test.Framework.TestVerdict expVerdict = Test.Framework.TestVerdict.Pass;
            string expResult = "Setting/resolving default TopicQos succeeded.";

            DDS.DomainParticipantFactory factory;
            DDS.IDomainParticipant       participant;
            DDS.DomainParticipantQos     pqosHolder = null;
            DDS.TopicQos   tqosHolder = null;
            DDS.ReturnCode returnCode;
            factory = DDS.DomainParticipantFactory.Instance;
            if (factory == null)
            {
                result = new Test.Framework.TestResult(expResult, "DomainParticipantFactory could not be initialised."
                                                       , expVerdict, Test.Framework.TestVerdict.Fail);
                return(result);
            }

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

            if (participant.GetDefaultTopicQos(ref tqosHolder) != DDS.ReturnCode.Ok)
            {
                result = new Test.Framework.TestResult(expResult, "Topic qos could not be resolved."
                                                       , expVerdict, Test.Framework.TestVerdict.Fail);
                return(result);
            }
            returnCode = factory.DeleteParticipant(participant);
            if (returnCode != DDS.ReturnCode.Ok)
            {
                result = new Test.Framework.TestResult(expResult, "Deletion of DomainParticipant failed."
                                                       , expVerdict, Test.Framework.TestVerdict.Fail);
                return(result);
            }
            result = new Test.Framework.TestResult(expResult, expResult, expVerdict, expVerdict
                                                   );
            return(result);
        }
Exemplo n.º 60
0
        public override Test.Framework.TestResult Run()
        {
            DDS.TopicQos      tQos  = null;
            DDS.DataWriterQos dwQos = null;
            DDS.ReturnCode    rc;
            string            expResult = "Initialization success";

            Test.Framework.TestResult result = new Test.Framework.TestResult(
                expResult,
                string.Empty,
                Test.Framework.TestVerdict.Pass,
                Test.Framework.TestVerdict.Fail);

            bce.typeSupport2 = new mod.embeddedStructTypeTypeSupport();
            rc = bce.typeSupport2.RegisterType(bce.participant, "embeddedStructType");
            if (rc != DDS.ReturnCode.Ok)
            {
                result.Result = "Typesupport could not be registered.";
                return(result);
            }
            rc = bce.participant.GetDefaultTopicQos(ref tQos);
            if (rc != DDS.ReturnCode.Ok)
            {
                result.Result = "Default TopicQos could not be resolved.";
                return(result);
            }
            bce.topic2 = bce.participant.CreateTopic("embeddedStruct", "embeddedStructType", tQos);
            if (bce.topic2 == null)
            {
                result.Result = "Topic could not be created.";
                return(result);
            }
            rc = bce.publisher.GetDefaultDataWriterQos(ref dwQos);
            if (rc != DDS.ReturnCode.Ok)
            {
                result.Result = "Default DataWriterQos could not be resolved.";
                return(result);
            }
            bce.datawriter2 = (mod.embeddedStructTypeDataWriter)bce.publisher.CreateDataWriter(bce.topic2, dwQos);
            if (bce.datawriter2 == null)
            {
                result.Result = "DataWriter could not be created.";
                return(result);
            }

            result.Result  = expResult;
            result.Verdict = Test.Framework.TestVerdict.Pass;
            return(result);
        }