Exemple #1
0
        public void TestGiopConnectionDescCodeSetNotSetAccess()
        {
            GiopConnectionDesc desc =
                new GiopConnectionDesc(null, null);

            Assert.IsTrue(
                !desc.IsCodeSetDefined(), "No codeset user defined at construction time");
            try
            {
                int charSet = desc.CharSet;
                Assert.Fail("Expected expection, when accessing charset, although not set");
            }
            catch (INTERNAL)
            {
                // expected.
            }
            try
            {
                int wcharSet = desc.WCharSet;
                Assert.Fail("Expected expection, when accessing charset, although not set");
            }
            catch (INTERNAL)
            {
                // expected.
            }
        }
Exemple #2
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");
        }
Exemple #3
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");
        }
Exemple #4
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>
 /// set the codesets for the stream after codeset service descision
 /// </summary>
 /// <param name="cdrStream"></param>
 private void SetCodeSet(CdrOutputStream cdrStream, GiopConnectionDesc conDesc) {
     if (conDesc.IsCodeSetDefined()) {
         // set the codeset, if one is chosen
         cdrStream.CharSet = conDesc.CharSet;
         cdrStream.WCharSet = conDesc.WCharSet;
     } // otherwise: use cdrStream default.
 }
        /// <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();
            }
            
        }