コード例 #1
0
ファイル: TypeSupport3.cs プロジェクト: xrl/opensplice
        public override Test.Framework.TestResult Run()
        {
            string expResult = "register_typesupport tests pass";
            DDS.DomainParticipantFactory factory;
            DDS.DomainParticipantQos participantQosHolder = null;
            DDS.IDomainParticipant participant;
            mod.tstTypeSupport typeSupport;
            mod.otherTypeTypeSupport otherTypeTypeSupport;
            DDS.ReturnCode rc;
            Test.Framework.TestResult result;
            result = new Test.Framework.TestResult(expResult, string.Empty, Test.Framework.TestVerdict
                .Pass, Test.Framework.TestVerdict.Fail);
            factory = DDS.DomainParticipantFactory.Instance;
            if (factory == null)
            {
                result.Result = "DomainParticipantFactory.get_instance() did not return a factory (1)";
                return result;
            }

            if (factory.GetDefaultParticipantQos(ref participantQosHolder) != DDS.ReturnCode.Ok)
            {
                result.Result = "factory.get_default_participant_qos() did not return a qos (2)";
                return result;
            }
            participant = factory.CreateParticipant(string.Empty, participantQosHolder);//, null, 0);
            if (participant == null)
            {
                result.Result = "factory.create_participant() did not return a participant (2)";
                return result;
            }
            typeSupport = new mod.tstTypeSupport();
            otherTypeTypeSupport = new mod.otherTypeTypeSupport();

            rc = typeSupport.RegisterType(participant, "type1");
            if (rc != DDS.ReturnCode.Ok)
            {
                result.Result = "could not register a type (3)";
                return result;
            }
            rc = typeSupport.RegisterType(participant, "type1");
            if (rc != DDS.ReturnCode.Ok)
            {
                result.Result = "could not register the same type a second time (4)";
                return result;
            }
            rc = otherTypeTypeSupport.RegisterType(participant, "type2");
            if (rc != DDS.ReturnCode.Ok)
            {
                result.Result = "could register a different type (5)";
                return result;
            }
            rc = otherTypeTypeSupport.RegisterType(participant, "type1");
            if (rc != DDS.ReturnCode.PreconditionNotMet)
            {
                result.Result = "Expected RETCODE_PRECONDITION_NOT_MET but recieved " + rc + " after calling register_type using an already used name for a different type (6)";
                return result;
            }
            rc = factory.DeleteParticipant(participant);
            if (rc != DDS.ReturnCode.Ok)
            {
                result.Result = "could not delete a participant (7)";
                return result;
            }
            result.Result = expResult;
            result.Verdict = Test.Framework.TestVerdict.Pass;
            return result;
        }
コード例 #2
0
ファイル: TypeSupport4.cs プロジェクト: fville/opensplice
        public override Test.Framework.TestResult Run()
        {
            string expResult = "get_type_name returns the correct name";

            DDS.DomainParticipantFactory factory;
            DDS.DomainParticipantQos     participantQosHolder = null;
            DDS.IDomainParticipant       participant;
            mod.tstTypeSupport           typeSupport;
            DDS.ReturnCode            rc;
            Test.Framework.TestResult result;
            result = new Test.Framework.TestResult(expResult, string.Empty, Test.Framework.TestVerdict
                                                   .Pass, Test.Framework.TestVerdict.Fail);
            factory = DDS.DomainParticipantFactory.Instance;
            if (factory == null)
            {
                result.Result = "DomainParticipantFactory.get_instance() did not return a factory";
                return(result);
            }

            if (factory.GetDefaultParticipantQos(ref participantQosHolder) != DDS.ReturnCode.Ok)
            {
                result.Result = "factory.get_default_participant_qos() did not return a qos";
                return(result);
            }
            participant = factory.CreateParticipant(string.Empty, participantQosHolder);//, null, 0);
            if (participant == null)
            {
                result.Result = "factory.create_participant() did not return a participant";
                return(result);
            }
            typeSupport = new mod.tstTypeSupport();
            string typeName = typeSupport.TypeName;

            if (typeName == null)
            {
                result.Result = "get_type_name returned null (1)";
                return(result);
            }
            if (!typeName.Equals("mod::tst"))
            {
                result.Result = "get_type_name returned incorrect typename (1)";
                return(result);
            }
            rc = typeSupport.RegisterType(participant, "type1");
            if (rc != DDS.ReturnCode.Ok)
            {
                result.Result = "could not register a type";
                return(result);
            }
            typeName = typeSupport.TypeName;
            if (typeName == null)
            {
                result.Result = "get_type_name returned null (2)";
                return(result);
            }
            if (!typeName.Equals("mod::tst"))
            {
                result.Result = "get_type_name returned incorrect typename (2)";
                return(result);
            }
            mod.otherTypeTypeSupport typeSupport2 = new mod.otherTypeTypeSupport();
            typeName = typeSupport2.TypeName;
            if (typeName == null)
            {
                result.Result = "get_type_name returned null (3)";
                return(result);
            }
            if (!typeName.Equals("mod::otherType"))
            {
                result.Result = "get_type_name returned incorrect typename (3)";
                return(result);
            }
            rc = factory.DeleteParticipant(participant);
            if (rc != DDS.ReturnCode.Ok)
            {
                result.Result = "participant could not be deleted (12)";
                return(result);
            }
            result.Result  = expResult;
            result.Verdict = Test.Framework.TestVerdict.Pass;
            return(result);
        }
コード例 #3
0
ファイル: TypeSupport4.cs プロジェクト: xrl/opensplice
        public override Test.Framework.TestResult Run()
        {
            string expResult = "get_type_name returns the correct name";
            DDS.DomainParticipantFactory factory;
            DDS.DomainParticipantQos participantQosHolder = null;
            DDS.IDomainParticipant participant;
            mod.tstTypeSupport typeSupport;
            DDS.ReturnCode rc;
            Test.Framework.TestResult result;
            result = new Test.Framework.TestResult(expResult, string.Empty, Test.Framework.TestVerdict
                .Pass, Test.Framework.TestVerdict.Fail);
            factory = DDS.DomainParticipantFactory.Instance;
            if (factory == null)
            {
                result.Result = "DomainParticipantFactory.get_instance() did not return a factory";
                return result;
            }

            if (factory.GetDefaultParticipantQos(ref participantQosHolder) != DDS.ReturnCode.Ok)
            {
                result.Result = "factory.get_default_participant_qos() did not return a qos";
                return result;
            }
            participant = factory.CreateParticipant(string.Empty, participantQosHolder);//, null, 0);
            if (participant == null)
            {
                result.Result = "factory.create_participant() did not return a participant";
                return result;
            }
            typeSupport = new mod.tstTypeSupport();
            string typeName = typeSupport.TypeName;
            if (typeName == null)
            {
                result.Result = "get_type_name returned null (1)";
                return result;
            }
            if (!typeName.Equals("mod::tst"))
            {
                result.Result = "get_type_name returned incorrect typename (1)";
                return result;
            }
            rc = typeSupport.RegisterType(participant, "type1");
            if (rc != DDS.ReturnCode.Ok)
            {
                result.Result = "could not register a type";
                return result;
            }
            typeName = typeSupport.TypeName;
            if (typeName == null)
            {
                result.Result = "get_type_name returned null (2)";
                return result;
            }
            if (!typeName.Equals("mod::tst"))
            {
                result.Result = "get_type_name returned incorrect typename (2)";
                return result;
            }
            mod.otherTypeTypeSupport typeSupport2 = new mod.otherTypeTypeSupport();
            typeName = typeSupport2.TypeName;
            if (typeName == null)
            {
                result.Result = "get_type_name returned null (3)";
                return result;
            }
            if (!typeName.Equals("mod::otherType"))
            {
                result.Result = "get_type_name returned incorrect typename (3)";
                return result;
            }
            rc = factory.DeleteParticipant(participant);
            if (rc != DDS.ReturnCode.Ok)
            {
                result.Result = "participant could not be deleted (12)";
                return result;
            }
            result.Result = expResult;
            result.Verdict = Test.Framework.TestVerdict.Pass;
            return result;
        }
コード例 #4
0
ファイル: TypeSupport3.cs プロジェクト: fville/opensplice
        public override Test.Framework.TestResult Run()
        {
            string expResult = "register_typesupport tests pass";

            DDS.DomainParticipantFactory factory;
            DDS.DomainParticipantQos     participantQosHolder = null;
            DDS.IDomainParticipant       participant;
            mod.tstTypeSupport           typeSupport;
            mod.otherTypeTypeSupport     otherTypeTypeSupport;
            DDS.ReturnCode            rc;
            Test.Framework.TestResult result;
            result = new Test.Framework.TestResult(expResult, string.Empty, Test.Framework.TestVerdict
                                                   .Pass, Test.Framework.TestVerdict.Fail);
            factory = DDS.DomainParticipantFactory.Instance;
            if (factory == null)
            {
                result.Result = "DomainParticipantFactory.get_instance() did not return a factory (1)";
                return(result);
            }

            if (factory.GetDefaultParticipantQos(ref participantQosHolder) != DDS.ReturnCode.Ok)
            {
                result.Result = "factory.get_default_participant_qos() did not return a qos (2)";
                return(result);
            }
            participant = factory.CreateParticipant(string.Empty, participantQosHolder);//, null, 0);
            if (participant == null)
            {
                result.Result = "factory.create_participant() did not return a participant (2)";
                return(result);
            }
            typeSupport          = new mod.tstTypeSupport();
            otherTypeTypeSupport = new mod.otherTypeTypeSupport();

            rc = typeSupport.RegisterType(participant, "type1");
            if (rc != DDS.ReturnCode.Ok)
            {
                result.Result = "could not register a type (3)";
                return(result);
            }
            rc = typeSupport.RegisterType(participant, "type1");
            if (rc != DDS.ReturnCode.Ok)
            {
                result.Result = "could not register the same type a second time (4)";
                return(result);
            }
            rc = otherTypeTypeSupport.RegisterType(participant, "type2");
            if (rc != DDS.ReturnCode.Ok)
            {
                result.Result = "could register a different type (5)";
                return(result);
            }
            rc = otherTypeTypeSupport.RegisterType(participant, "type1");
            if (rc != DDS.ReturnCode.PreconditionNotMet)
            {
                result.Result = "Expected RETCODE_PRECONDITION_NOT_MET but recieved " + rc + " after calling register_type using an already used name for a different type (6)";
                return(result);
            }
            rc = factory.DeleteParticipant(participant);
            if (rc != DDS.ReturnCode.Ok)
            {
                result.Result = "could not delete a participant (7)";
                return(result);
            }
            result.Result  = expResult;
            result.Verdict = Test.Framework.TestVerdict.Pass;
            return(result);
        }