Exemple #1
0
        public void TestNonUsableProfileIncluded()
        {
            string iorString = "IOR:000000000000001b49444c3a636d6956322f5573657241636365737356323a312e3000020000000210ca1000000000650000000800000008646576312d73660033de6f8e0000004d000000020000000855736572504f41000000001043415355736572416363657373563200c3fbedfb0000000e007c4c51000000fd57aacdaf801a0000000e007c4c51000000fd57aacdaf80120000009400000000000000980001023100000008646576312d736600200b00020000004d000000020000000855736572504f41000000001043415355736572416363657373563200c3fbedfb0000000e007c4c51000000fd57aacdaf801a0000000e007c4c51000000fd57aacdaf8012000000140000000200000002000000140000000400000001000000230000000400000001000000000000000800000000cb0e0001";
            Ior    ior       = new Ior(iorString);

            Assert.AreEqual("IDL:cmiV2/UserAccessV2:1.0", ior.TypID, "wrong RepositoryId");
            IInternetIiopProfile iiopProf = ior.FindInternetIiopProfile();

            Assert.NotNull(iiopProf, "iiop ior profile not found");
            Assert.AreEqual("dev1-sf", iiopProf.HostName, "wrong hostname");
            Assert.AreEqual(8203, iiopProf.Port, "wrong port");
            Assert.AreEqual(1, iiopProf.Version.Major, "wrong major");
            Assert.AreEqual(2, iiopProf.Version.Minor, "wrong minor");
            Assert.AreEqual(2, ior.Profiles.Length, "wrong number of profiles");
        }
Exemple #2
0
        /// <summary>
        /// This method parses an url for the IIOP channel.
        /// It extracts the channel URI and the objectURI
        /// </summary>
        /// <param name="url">the url to parse</param>
        /// <param name="objectURI">the objectURI</param>
        /// <returns>the channel-Uri</returns>
        internal Uri ParseUrl(string url, out string objectUri,
                              out GiopVersion version)
        {
            Uri uri = null;

            if (url.StartsWith("iiop"))
            {
                IiopLoc iiopLoc = new IiopLoc(url, m_codec,
                                              m_defaultAdditionalTaggedComponents);
                uri = iiopLoc.ParseUrl(out objectUri, out version);
            }
            else if (url.StartsWith("IOR"))
            {
                Ior ior = new Ior(url);
                IInternetIiopProfile profile = ior.FindInternetIiopProfile();
                if (profile != null)
                {
                    uri = new Uri("iiop" + profile.Version.Major + "." + profile.Version.Minor +
                                  Uri.SchemeDelimiter + profile.HostName + ":" + profile.Port);
                    objectUri = IorUtil.GetObjectUriForObjectKey(profile.ObjectKey);
                    version   = profile.Version;
                }
                else
                {
                    uri       = null;
                    objectUri = null;
                    version   = new GiopVersion(1, 0);
                }
            }
            else if (url.StartsWith("corbaloc"))
            {
                Corbaloc loc = new Corbaloc(url, m_codec,
                                            m_defaultAdditionalTaggedComponents);
                uri = loc.ParseUrl(out objectUri, out version);
            }
            else
            {
                // not possible
                uri       = null;
                objectUri = null;
                version   = new GiopVersion(1, 0);
            }
            return(uri);
        }
Exemple #3
0
        private void CheckIorForUrl(Ior iorForUrl, int expectedNumberOfComponents,
                                    bool shouldHaveCodeSetComponent)
        {
            Assert.AreEqual(1, iorForUrl.Profiles.Length, "number of profiles");
            Assert.AreEqual(typeof(MarshalByRefObject),
                            iorForUrl.Type, "type");
            IIorProfile profile = iorForUrl.FindInternetIiopProfile();

            Assert.NotNull(profile, "internet iiop profile");
            Assert.AreEqual(
                new byte[] { 116, 101, 115, 116 },
                profile.ObjectKey, "profile object key");
            Assert.AreEqual(new GiopVersion(1, 2), profile.Version, "profile giop version");

            if (shouldHaveCodeSetComponent)
            {
                Assert.AreEqual(
                    expectedNumberOfComponents,
                    profile.TaggedComponents.Count, "number of components");
                Assert.IsTrue(profile.ContainsTaggedComponent(
                                  CodeSetService.SERVICE_ID), "code set component present");
                CodeSetComponentData data = (CodeSetComponentData)
                                            profile.TaggedComponents.GetComponentData(CodeSetService.SERVICE_ID,
                                                                                      m_codec,
                                                                                      CodeSetComponentData.TypeCode);
                Assert.AreEqual(
                    (int)CharSet.LATIN1,
                    data.NativeCharSet, "code set component: native char set");
                Assert.AreEqual(
                    (int)WCharSet.UTF16,
                    data.NativeWCharSet, "code set component: native char set");
            }
            else
            {
                Assert.IsTrue(
                    !profile.ContainsTaggedComponent(
                        CodeSetService.SERVICE_ID), "code set component present");
            }
        }