Ejemplo n.º 1
0
        public void TestGiopConnectionDescCodeSetNotSet()
        {
            GiopConnectionDesc desc =
                new GiopConnectionDesc(null, null);

            Assert.IsTrue(
                !desc.IsCodeSetNegotiated(), "Codeset not negotiated at construction time");
            Assert.IsTrue(
                !desc.IsCodeSetDefined(), "No codeset user defined at construction time");
        }
Ejemplo n.º 2
0
        public void TestGiopConnectionDescSetCodeSetNegotiated()
        {
            GiopConnectionDesc desc =
                new GiopConnectionDesc(null, null);

            desc.SetCodeSetNegotiated();
            Assert.IsTrue(
                desc.IsCodeSetNegotiated(), "Codeset negotiated");
            Assert.IsTrue(
                !desc.IsCodeSetDefined(), "Codeset not user defined");
        }
Ejemplo n.º 3
0
        public void TestGiopConnectionDescSetCodeSet()
        {
            int charSet             = 0x5010001;
            int wcharSet            = 0x10100;
            GiopConnectionDesc desc =
                new GiopConnectionDesc(null, null);

            desc.SetNegotiatedCodeSets(charSet, wcharSet);
            Assert.IsTrue(
                desc.IsCodeSetNegotiated(), "Codeset negotiated");
            Assert.AreEqual(charSet, desc.CharSet, "char set");
            Assert.AreEqual(wcharSet, desc.WCharSet, "wchar set");
            Assert.IsTrue(desc.IsCodeSetDefined(), "Codeset user defined");
        }
 /// <summary>
 /// perform code set establishment on the server side
 /// </summary>
 protected void PerformCodeSetEstablishmentServer(GiopVersion version,
                                                  GiopConnectionDesc conDesc, 
                                                  ServiceContextList cntxColl) {
     if (version.IsAfterGiop1_0()) {
         if (!conDesc.IsCodeSetNegotiated()) {
             // check for code set establishment
             CodeSetServiceContext context = 
                 CodeSetService.FindCodeSetServiceContext(cntxColl);
             if (context != null) {
                 CodeSetService.CheckCodeSetCompatible(context.CharSet,
                                                       context.WCharSet);
                 conDesc.SetNegotiatedCodeSets(context.CharSet,
                                               context.WCharSet);
             }
         }
     } else {
         conDesc.SetCodeSetNegotiated();
     }
 }
        /// <summary>
        /// perform code set establishment on the client side
        /// </summary>
        protected void PerformCodeSetEstablishmentClient(IIorProfile targetProfile,
                                                         GiopConnectionDesc conDesc,
                                                         ServiceContextList cntxColl) {
            
            if (targetProfile.Version.IsAfterGiop1_0()) {

                if (!conDesc.IsCodeSetNegotiated()) {
                    Codec codec =
                        m_codecFactory.create_codec(new Encoding(ENCODING_CDR_ENCAPS.ConstVal,
                                                                 targetProfile.Version.Major,
                                                                 targetProfile.Version.Minor));
                    object codeSetComponent = CodeSetService.FindCodeSetComponent(targetProfile, codec);
                    if (codeSetComponent != null) {
                        int charSet = CodeSetService.ChooseCharSet((CodeSetComponentData)codeSetComponent);
                        int wcharSet = CodeSetService.ChooseWCharSet((CodeSetComponentData)codeSetComponent);
                        conDesc.SetNegotiatedCodeSets(charSet, wcharSet);
                    } else {
                        conDesc.SetCodeSetNegotiated();
                    }
                    if (conDesc.IsCodeSetDefined()) {
                        // only insert a codeset service context, if a codeset is selected
                        CodeSetService.InsertCodeSetServiceContext(cntxColl,
                            conDesc.CharSet, conDesc.WCharSet);
                    }
                }
            } else {
                // giop 1.0; don't send code set service context; don't check again
                conDesc.SetCodeSetNegotiated();
            }
            
        }