コード例 #1
0
ファイル: IIOPURLUtil.cs プロジェクト: divyang4481/IIOPNet
        /// <summary>creates an IOR for the object described by the Url url</summary>
        /// <param name="url">an url of the form IOR:--hex-- or iiop://addr/key</param>
        /// <param name="targetType">if the url contains no info about the target type, use this type</param>
        public Ior CreateIorForUrl(string url, string repositoryId)
        {
            Ior ior = null;

            if (IsIorString(url))
            {
                ior = new Ior(url);
            }
            else if (url.StartsWith("iiop"))
            {
                // iiop1.0, iiop1.1, iiop1.2 (=iiop); extract version in protocol tag
                IiopLoc iiopLoc = new IiopLoc(url, m_codec,
                                              m_defaultAdditionalTaggedComponents);
                // now create an IOR with the above information
                ior = new Ior(repositoryId, iiopLoc.GetProfiles());
            }
            else if (url.StartsWith("corbaloc"))
            {
                Corbaloc loc = new Corbaloc(url, m_codec,
                                            m_defaultAdditionalTaggedComponents);
                IorProfile[] profiles = loc.GetProfiles();
                ior = new Ior(repositoryId, profiles);
            }
            else
            {
                throw new INV_OBJREF(1963, CompletionStatus.Completed_MayBe);
            }
            return(ior);
        }
コード例 #2
0
        public void TestMultipleCompleteCorbaLocIiop()
        {
            string   testCorbaLoc = "corbaloc:iiop:[email protected]:1234,:[email protected]:1235,:[email protected]:1236/test";
            Corbaloc parsed       = new Corbaloc(testCorbaLoc, m_codec,
                                                 new object[] { m_defaultCodeSetTaggedComponent });

            Assert.AreEqual("test", parsed.KeyString);

            IorProfile[] profiles = parsed.GetProfiles();
            Assert.AreEqual(3, profiles.Length);
            Assert.AreEqual(typeof(InternetIiopProfile), profiles[0].GetType());
            Assert.AreEqual(typeof(InternetIiopProfile), profiles[1].GetType());
            Assert.AreEqual(typeof(InternetIiopProfile), profiles[2].GetType());

            InternetIiopProfile prof = (InternetIiopProfile)(profiles[0]);

            Assert.AreEqual(1, prof.Version.Major);
            Assert.AreEqual(2, prof.Version.Minor);
            Assert.AreEqual("elca.ch", prof.HostName);
            Assert.AreEqual(1234, prof.Port);

            prof = (InternetIiopProfile)(profiles[1]);
            Assert.AreEqual(1, prof.Version.Major);
            Assert.AreEqual(2, prof.Version.Minor);
            Assert.AreEqual("elca.ch", prof.HostName);
            Assert.AreEqual(1235, prof.Port);

            prof = (InternetIiopProfile)(profiles[2]);
            Assert.AreEqual(1, prof.Version.Major);
            Assert.AreEqual(2, prof.Version.Minor);
            Assert.AreEqual("elca.ch", prof.HostName);
            Assert.AreEqual(1236, prof.Port);
        }
コード例 #3
0
        public void TestSingleCompleteCorbaLocIiop()
        {
            string   testCorbaLoc = "corbaloc:iiop:[email protected]:1234/test";
            Corbaloc parsed       = new Corbaloc(testCorbaLoc, m_codec,
                                                 new object[] { m_defaultCodeSetTaggedComponent });

            Assert.AreEqual("test", parsed.KeyString);

            Assert.AreEqual(1, parsed.GetProfiles().Length);
            Assert.AreEqual(typeof(InternetIiopProfile), parsed.GetProfiles()[0].GetType());
            InternetIiopProfile profile = (InternetIiopProfile)parsed.GetProfiles()[0];

            Assert.IsTrue(profile.TaggedComponents.ContainsTaggedComponent(
                              CodeSetService.SERVICE_ID));

            Assert.AreEqual(1, profile.Version.Major);
            Assert.AreEqual(2, profile.Version.Minor);
            Assert.AreEqual("elca.ch", profile.HostName);
            Assert.AreEqual(1234, profile.Port);

            // port > 32768
            testCorbaLoc = "corbaloc:iiop:[email protected]:61234/test";
            parsed       = new Corbaloc(testCorbaLoc, m_codec,
                                        new object[] { m_defaultCodeSetTaggedComponent });
            Assert.AreEqual("test", parsed.KeyString);

            Assert.AreEqual(1, parsed.GetProfiles().Length);
            Assert.AreEqual(typeof(InternetIiopProfile), parsed.GetProfiles()[0].GetType());
            profile = (InternetIiopProfile)parsed.GetProfiles()[0];
            Assert.IsTrue(profile.TaggedComponents.ContainsTaggedComponent(
                              CodeSetService.SERVICE_ID));

            Assert.AreEqual(1, profile.Version.Major);
            Assert.AreEqual(2, profile.Version.Minor);
            Assert.AreEqual("elca.ch", profile.HostName);
            Assert.AreEqual(61234, profile.Port);
        }
コード例 #4
0
        public void TestCorbaLocIiopSsl()
        {
            string   testCorbaLoc = "corbaloc:iiop-ssl:elca.ch:1234/test";
            Corbaloc parsed       = new Corbaloc(testCorbaLoc, m_codec,
                                                 new object[] { m_defaultCodeSetTaggedComponent });

            Assert.AreEqual("test", parsed.KeyString);
            IorProfile[] profiles = parsed.GetProfiles();
            Assert.AreEqual(1, profiles.Length);
            Assert.AreEqual(typeof(InternetIiopProfile), profiles[0].GetType());
            InternetIiopProfile prof = (InternetIiopProfile)(profiles[0]);

            Assert.AreEqual(1, prof.Version.Major);
            Assert.AreEqual(0, prof.Version.Minor);
            Assert.AreEqual("elca.ch", prof.HostName);
            Assert.AreEqual(0, prof.Port);


            Assert.IsTrue(profiles[0].TaggedComponents.ContainsTaggedComponent(
                              CodeSetService.SERVICE_ID));
            Assert.IsTrue(profiles[0].TaggedComponents.ContainsTaggedComponent(
                              TAG_SSL_SEC_TRANS.ConstVal));
        }