Exemplo n.º 1
0
        /// <summary>gets a reference to the init service running at the specified host at the specified port</summary>
        private CORBAInitService GetInitService(string host, int port)
        {
            lock (m_initalServices.SyncRoot) {
                CORBAInitService initService = null;
                string           key         = host + ":" + port;
                if (!m_initalServices.ContainsKey(key))
                {
                    IorProfile initServiceProfile =
                        new InternetIiopProfile(new GiopVersion(1, 0),
                                                host, (ushort)port,
                                                IorUtil.GetKeyBytesForId(CORBAInitServiceImpl.INITSERVICE_NAME));
                    // don't add a codeset component, because giop 1.0
                    Ior initServiceIor = new Ior(Repository.GetRepositoryID(typeof(CORBAInitService)),
                                                 new IorProfile[] { initServiceProfile });

                    string iorString = initServiceIor.ToString();
                    initService = (CORBAInitService)RemotingServices.Connect(typeof(CORBAInitService),
                                                                             iorString); // CORBAInitService type not verifiable remote -> make sure that it's possible to verify locally
                    m_initalServices.Add(key, initService);
                }
                else
                {
                    initService = (CORBAInitService)m_initalServices[key];
                }
                return(initService);
            }
        }
Exemplo n.º 2
0
        public void TestStringToObjectIORUnknownType()
        {
            Ior ior = new Ior("IDL:Ch/Elca/Iiop/Tests/TestClientUnknownIf1:1.0",
                              new IorProfile[] { m_profile });
            string iorString   = ior.ToString();
            object objToString = m_orb.string_to_object(iorString);

            Assert.NotNull(objToString, "obj to string not created");
            Assert.IsTrue(
                RemotingServices.IsTransparentProxy(objToString), "obj not a proxy");
        }
Exemplo n.º 3
0
        public void TestStringToObjectIORNormal()
        {
            Ior ior = new Ior("IDL:omg.org/CORBA/Object:1.0",
                              new IorProfile[] { m_profile });
            string iorString   = ior.ToString();
            object objToString = m_orb.string_to_object(iorString);

            Assert.NotNull(objToString, "obj to string not created");
            Assert.IsTrue(
                RemotingServices.IsTransparentProxy(objToString), "obj not a proxy");
        }
Exemplo n.º 4
0
        /// <summary>takes an IOR or a corbaloc and returns a proxy</summary>
        public object string_to_object([StringValue] string uri)
        {
            CheckIsValidUri(uri);
            Ior ior = IiopUrlUtil.CreateIorForUrl(uri, String.Empty);
            // performance opt: if an ior passed in, use it
            string iorString = uri;

            if (!IiopUrlUtil.IsIorString(uri))
            {
                iorString = ior.ToString();
            }
            Type type = ReflectionHelper.MarshalByRefObjectType;

            if (ior.Type != null)
            { // type is known
                type = ior.Type;
            } // if not known, use MarshalByRefObject
            return(RemotingServices.Connect(type, iorString));
        }
Exemplo n.º 5
0
        public void TestParseAndRecreate()
        {
            string iorString = BitConverter.IsLittleEndian
                                ? "IOR:0000000000000024524d493a48656c6c6f496e746572666163653a3030303030303030303030303030303000000000010000000000000050010102000c00000031302e34302e32302e353100951f00000800000053617948656c6c6f0100000001000000200000000000000000010001000000020501000100010020000101090000000100010100"
                                : "IOR:0000000000000024524d493a48656c6c6f496e746572666163653a3030303030303030303030303030303000000000010000000000000050000102000000000c31302e34302e32302e3531001f9500000000000853617948656C6C6F0000000100000001000000200000000000010001000000020501000100010020000101090000000100010100";
            Ior    ior       = new Ior(iorString);
            string recreated = ior.ToString();

            Assert.AreEqual(iorString.ToLower(),
                            recreated.ToLower(), "ior not recreated");

            string iorString2 = BitConverter.IsLittleEndian
                                 ? "IOR:000000000000001B49444C3A636D6956322F5573657241636365737356323A312E3000000000000210CA1000000000650000000800000008646576312D73660033DE6F8E0000004D000000020000000855736572504F41000000001043415355736572416363657373563200C3FBEDFB0000000E007C4C51000000FD57AACDAF801A0000000E007C4C51000000FD57AACDAF80120000000000000000000000980101020008000000646576312D7366000B2000004D000000000000020000000855736572504F41000000001043415355736572416363657373563200C3FBEDFB0000000E007C4C51000000FD57AACDAF801A0000000E007C4C51000000FD57AACDAF8012000000000200000002000000140000000000000400000001000000230000000400000001000000000800000000000000CB0E0001"
                                 : "IOR:000000000000001b49444c3a636d6956322f5573657241636365737356323a312e3000000000000210ca1000000000650000000800000008646576312d73660033de6f8e0000004d000000020000000855736572504f41000000001043415355736572416363657373563200c3fbedfb0000000e007c4c51000000fd57aacdaf801a0000000e007c4c51000000fd57aacdaf80120000000000000000000000980001020000000008646576312d736600200b00000000004d000000020000000855736572504f41000000001043415355736572416363657373563200c3fbedfb0000000e007c4c51000000fd57aacdaf801a0000000e007c4c51000000fd57aacdaf8012000000000000000200000002000000140000000400000001000000230000000400000001000000000000000800000000cb0e0001";
            Ior    ior2       = new Ior(iorString2);
            string recreated2 = ior2.ToString();

            Assert.AreEqual(iorString2.ToLower(),
                            recreated2.ToLower(), "ior2 not recreated");
        }