Example #1
0
        public static void Main(String[] args)
        {
            IOrbServices        orb = OrbServices.GetSingleton();
            TestInterceptorInit testInterceptorInit = new TestInterceptorInit();

            orb.RegisterPortableInterceptorInitalizer(testInterceptorInit);

            // register the channel
            int         port = 8087;
            IiopChannel chan = new IiopChannel(port);

            ChannelServices.RegisterChannel(chan, false);

            orb.CompleteInterceptorRegistration();

            TestInterceptorControlService controlService =
                new TestInterceptorControlService(testInterceptorInit);
            string objectURIControlService = "interceptorControl";

            RemotingServices.Marshal(controlService, objectURIControlService);

            TestService test      = new TestService();
            string      objectURI = "test";

            RemotingServices.Marshal(test, objectURI);

            Console.WriteLine("server running");
            Thread.Sleep(Timeout.Infinite);
        }
Example #2
0
        public void SetUp()
        {
            m_orb = OrbServices.GetSingleton();

            m_channel = new IiopChannel(TEST_PORT);
            ChannelServices.RegisterChannel(m_channel, false);
        }
Example #3
0
        private void RegisterInterceptors()
        {
            IOrbServices orb = OrbServices.GetSingleton();

            m_testInterceptorInit = new TestInterceptorInit();
            orb.RegisterPortableInterceptorInitalizer(m_testInterceptorInit);
            orb.CompleteInterceptorRegistration();
        }
Example #4
0
        public object RetrieveIdlIntArrayAsAny([IdlArray(0L, 5)] int[] arg)
        {
            // test with explicit typecode-creation
            IOrbServices orbServices = OrbServices.GetSingleton();

            omg.org.CORBA.TypeCode arrayTC =
                orbServices.create_array_tc(5, orbServices.create_tc_for_type(typeof(int)));
            Any arrayAsAny = new Any(arg, arrayTC);

            return(arrayAsAny);
        }
Example #5
0
        public object RetrieveIdlInt3DimArray2x2x3AsAny([IdlArray(0L, 2)][IdlArrayDimension(0L, 1, 2)][IdlArrayDimension(0L, 2, 3)] System.Int32[,,] arg)
        {
            // test with explicit typecode-creation
            IOrbServices orbServices = OrbServices.GetSingleton();

            omg.org.CORBA.TypeCode arrayTC =
                orbServices.create_array_tc(3, orbServices.create_tc_for_type(typeof(int)));
            arrayTC = orbServices.create_array_tc(2, arrayTC);
            arrayTC = orbServices.create_array_tc(2, arrayTC);
            Any arrayAsAny = new Any(arg, arrayTC);

            return(arrayAsAny);
        }
Example #6
0
        public void SetUp()
        {
            m_orb = OrbServices.GetSingleton();

            m_profile =
                new InternetIiopProfile(new GiopVersion(1, 2),
                                        "localhost",
                                        1001,
                                        new byte[] { 1, 0, 0, 0 });

            m_clientChannel = new IiopClientChannel();
            ChannelServices.RegisterChannel(m_clientChannel, false);
        }
Example #7
0
        public void TestSSLComponent()
        {
            IOrbServices orb       = OrbServices.GetSingleton();
            string       iorString = orb.object_to_string(m_newTestService);
            Ior          ior       = new Ior(iorString);

            Assert.IsTrue(ior.Profiles.Length > 0, "nr of profiles");
            IIorProfile profile = ior.Profiles[0];

            omg.org.IOP.CodecFactory codecFactory = (omg.org.IOP.CodecFactory)
                                                    orb.resolve_initial_references("CodecFactory");
            object sslData =
                profile.TaggedComponents.GetComponentData(20, codecFactory.create_codec(new omg.org.IOP.Encoding(omg.org.IOP.ENCODING_CDR_ENCAPS.ConstVal, 1, 2)),
                                                          SSLComponentData.TypeCode);

            Assert.NotNull(sslData);
            Assert.AreEqual((int)8087, ((SSLComponentData)sslData).GetPort());
        }
Example #8
0
        public void TestStringArrayAsAnyManualTypeCode()
        {
            string[]     argArray = new string[] { "a", "b", "c" };
            IOrbServices orb      = OrbServices.GetSingleton();

            // variant 1 with manually created type code
            omg.org.CORBA.TypeCode arrayTypeCode1 = orb.create_value_box_tc("RMI:[Ljava.lang.String;:071DA8BE7F971128:A0F0A4387A3BB342",
                                                                            "seq1_WStringValue",
                                                                            orb.create_tc_for_type(typeof(string)));
            Any arg1 = new Any(argArray,
                               arrayTypeCode1);

            string[] result1 = (string[])m_test.EchoAnything(arg1);
            Assertion.AssertNotNull(result1);
            Assertion.AssertEquals(argArray.Length, result1.Length);
            Assertion.AssertEquals(argArray[0], result1[0]);
            Assertion.AssertEquals(argArray[1], result1[1]);
            Assertion.AssertEquals(argArray[2], result1[2]);
        }
Example #9
0
        public void TestCodeSetComponent()
        {
            IOrbServices orb       = OrbServices.GetSingleton();
            string       iorString = orb.object_to_string(m_newTestService);
            Ior          ior       = new Ior(iorString);

            Assert.IsTrue(ior.Profiles.Length > 0, "nr of profiles");
            IIorProfile profile = ior.Profiles[0];

            omg.org.IOP.CodecFactory codecFactory = (omg.org.IOP.CodecFactory)
                                                    orb.resolve_initial_references("CodecFactory");
            object codeset =
                profile.TaggedComponents.GetComponentData(1, codecFactory.create_codec(new omg.org.IOP.Encoding(omg.org.IOP.ENCODING_CDR_ENCAPS.ConstVal, 1, 2)),
                                                          CodeSetComponentData.TypeCode);

            Assert.NotNull(codeset);
            Assert.AreEqual((int)CharSet.UTF8, ((CodeSetComponentData)codeset).NativeCharSet);
            Assert.AreEqual((int)WCharSet.UTF16, ((CodeSetComponentData)codeset).NativeWCharSet);
        }
Example #10
0
        public void SetupEnvironment() {
            MappingConfiguration.Instance.UseBoxedInAny = false; // disable boxing of string/arrays in any's
            // register the channel
            m_channel = new IiopClientChannel();
            ChannelServices.RegisterChannel(m_channel, false);

            NamingContext nameService = GetNameService();
            NameComponent[] name = new NameComponent[] { new NameComponent("test", "") };
            // get the reference to the test-service
            m_testService = (TestService)nameService.resolve(name);

            NameComponent[] nameInternal = 
                new NameComponent[] { new NameComponent("testInternal", "") };
            // get the reference to a service with a server-side only interface inherited from a public one
            m_testServiceInternalIf = 
               (TestSimpleServicePublic)nameService.resolve(nameInternal);

            m_orb = OrbServices.GetSingleton();
        }
Example #11
0
        public static void Main(String[] args)
        {
            IOrbServices orb = OrbServices.GetSingleton();

            orb.OverrideDefaultCharSets(CharSet.UTF8, WCharSet.UTF16);

            // register the channel
            int         port = 8087;
            IiopChannel chan = new IiopChannel(port);

            ChannelServices.RegisterChannel(chan, false);

            TestService test      = new TestService();
            string      objectURI = "test";

            RemotingServices.Marshal(test, objectURI);

            Console.WriteLine("server running");
            Thread.Sleep(Timeout.Infinite);
        }
Example #12
0
        public void SetupEnvironment()
        {
            MappingConfiguration.Instance.UseBoxedInAny = false; // disable boxing of string/arrays in any's
            // register the channel
            m_channel = new IiopClientChannel();
            ChannelServices.RegisterChannel(m_channel, false);

            NamingContext nameService = GetNameService();

            NameComponent[] name = new NameComponent[] { new NameComponent("test", "") };
            // get the reference to the test-service
            m_testService = (TestService)nameService.resolve(name);

            NameComponent[] nameInternal =
                new NameComponent[] { new NameComponent("testInternal", "") };
            // get the reference to a service with a server-side only interface inherited from a public one
            m_testServiceInternalIf =
                (TestSimpleServicePublic)nameService.resolve(nameInternal);

            m_orb = OrbServices.GetSingleton();
        }
Example #13
0
        public void TestOverrideCodeSetsWhenAlreadySet()
        {
            TaggedComponent defaultComponent =
                CodeSetService.CreateDefaultCodesetComponent(m_codec);
            CodeSetComponentData codeSetData = (CodeSetComponentData)
                                               m_codec.decode_value(defaultComponent.component_data,
                                                                    CodeSetComponentData.TypeCode);

            Assert.IsTrue(Enum.IsDefined(typeof(CharSet), codeSetData.NativeCharSet));
            Assert.IsTrue(Enum.IsDefined(typeof(WCharSet), codeSetData.NativeWCharSet));

            IOrbServices orbServices = OrbServices.GetSingleton();

            try
            {
                orbServices.OverrideDefaultCharSets(CharSet.UTF8, WCharSet.UTF16);
                Assert.Fail("expected bad_inv_order exception");
            }
            catch (BAD_INV_ORDER)
            {
                // expected, because already set
            }
        }
Example #14
0
 public void SetUp()
 {
     m_orb = OrbServices.GetSingleton();
 }
 static void Main(string[] args)
 {
     IOrbServices orb = OrbServices.GetSingleton();
     orb.OverrideDefaultCharSets(CharSet.UTF8, WCharSet.UTF16);
     orb.RegisterPortableInterceptorInitalizer(new MyOrbInitializer());
     orb.CompleteInterceptorRegistration();
        public void SetUp()
        {
            m_orb = OrbServices.GetSingleton();

            m_profile =
                new InternetIiopProfile(new GiopVersion(1, 2),
                                        "localhost",
                                        1001,
                                        new byte[] { 1, 0, 0, 0 });

            m_clientChannel = new IiopClientChannel();
            ChannelServices.RegisterChannel(m_clientChannel, false);
        }
 public void SetUp()
 {
     m_orb = OrbServices.GetSingleton();
 }
        public void SetUp()
        {
            m_orb = OrbServices.GetSingleton();

            m_channel = new IiopChannel(TEST_PORT);
            ChannelServices.RegisterChannel(m_channel, false);
        }