Ejemplo n.º 1
0
 public void TestNoCorbaLoc() {
     string otherUrl = "iiop://localhost:8087/test";
     Corbaloc parsed = new Corbaloc(otherUrl, m_codec,
                                    new object[] { m_defaultCodeSetTaggedComponent });
 }
Ejemplo n.º 2
0
 public void TestParseUrlSsl() {
     string testCorbaLoc = "corbaloc:iiop-ssl:[email protected]:1234/test";
     Corbaloc parsed = new Corbaloc(testCorbaLoc, m_codec,
                                    new object[] { m_defaultCodeSetTaggedComponent });
     string objectUri;
     GiopVersion version;
     Uri channelUri = parsed.ParseUrl(out objectUri, out version);
     Assert.AreEqual("test", objectUri, "object uri");
     Assert.AreEqual(1, version.Major, "version major");
     Assert.AreEqual(2, version.Minor, "version minor");
     Assert.AreEqual("iiop-ssl1.2://elca.ch:1234/",
                            channelUri.AbsoluteUri, "channel uri");
 }
Ejemplo n.º 3
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));
        }
Ejemplo n.º 4
0
        public void TestIncompleteCorbaLocIiop() {
            string testCorbaLoc = "corbaloc::/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("localhost", prof.HostName);
            Assert.AreEqual(2809, prof.Port);

            testCorbaLoc = "corbaloc::elca.ch/test";
            parsed = new Corbaloc(testCorbaLoc, m_codec,
                                  new object[] { m_defaultCodeSetTaggedComponent });
            Assert.AreEqual("test", parsed.KeyString);
            profiles = parsed.GetProfiles();
            Assert.AreEqual(1, profiles.Length);
            Assert.AreEqual(typeof(InternetIiopProfile), profiles[0].GetType());
            prof = (InternetIiopProfile)(profiles[0]);
            Assert.AreEqual(1, prof.Version.Major);
            Assert.AreEqual(0, prof.Version.Minor);
            Assert.AreEqual("elca.ch", prof.HostName);
            Assert.AreEqual(2809, prof.Port);

            testCorbaLoc = "corbaloc:iiop:[email protected]/test";
            parsed = new Corbaloc(testCorbaLoc, m_codec,
                                  new object[] { m_defaultCodeSetTaggedComponent });
            Assert.AreEqual("test", parsed.KeyString);
            profiles = parsed.GetProfiles();
            Assert.AreEqual(1, profiles.Length);
            Assert.AreEqual(typeof(InternetIiopProfile), profiles[0].GetType());
            prof = (InternetIiopProfile)(profiles[0]);
            Assert.AreEqual(1, prof.Version.Major);
            Assert.AreEqual(2, prof.Version.Minor);
            Assert.AreEqual("elca.ch", prof.HostName);
            Assert.AreEqual(2809, prof.Port);

            testCorbaLoc = "corbaloc::elca.ch:1234/test";
            parsed = new Corbaloc(testCorbaLoc, m_codec,
                                  new object[] { m_defaultCodeSetTaggedComponent });
            Assert.AreEqual("test", parsed.KeyString);
            profiles = parsed.GetProfiles();
            Assert.AreEqual(1, profiles.Length);
            Assert.AreEqual(typeof(InternetIiopProfile), profiles[0].GetType());
            prof = (InternetIiopProfile)(profiles[0]);
            Assert.AreEqual(1, prof.Version.Major);
            Assert.AreEqual(0, prof.Version.Minor);
            Assert.AreEqual("elca.ch", prof.HostName);
            Assert.AreEqual(1234, prof.Port);
        }
Ejemplo n.º 5
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);

        }
Ejemplo n.º 6
0
 /// <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;
 }
Ejemplo n.º 7
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;
 }