Esempio n. 1
0
        private void TestPbClientFactory()
        {
            IPEndPoint addr = new IPEndPoint(0);

            System.Console.Error.WriteLine(addr.GetHostName() + addr.Port);
            Configuration   conf     = new Configuration();
            ResourceTracker instance = new TestYSCRPCFactories.ResourceTrackerTestImpl(this);

            Org.Apache.Hadoop.Ipc.Server server = null;
            try
            {
                server = RpcServerFactoryPBImpl.Get().GetServer(typeof(ResourceTracker), instance
                                                                , addr, conf, null, 1);
                server.Start();
                System.Console.Error.WriteLine(server.GetListenerAddress());
                System.Console.Error.WriteLine(NetUtils.GetConnectAddress(server));
                ResourceTracker client = null;
                try
                {
                    client = (ResourceTracker)RpcClientFactoryPBImpl.Get().GetClient(typeof(ResourceTracker
                                                                                            ), 1, NetUtils.GetConnectAddress(server), conf);
                }
                catch (YarnRuntimeException e)
                {
                    Sharpen.Runtime.PrintStackTrace(e);
                    NUnit.Framework.Assert.Fail("Failed to create client");
                }
            }
            catch (YarnRuntimeException e)
            {
                Sharpen.Runtime.PrintStackTrace(e);
                NUnit.Framework.Assert.Fail("Failed to create server");
            }
            finally
            {
                server.Stop();
            }
        }
Esempio n. 2
0
        private void TestPbServerFactory()
        {
            IPEndPoint      addr     = new IPEndPoint(0);
            Configuration   conf     = new Configuration();
            ResourceTracker instance = new TestYSCRPCFactories.ResourceTrackerTestImpl(this);

            Org.Apache.Hadoop.Ipc.Server server = null;
            try
            {
                server = RpcServerFactoryPBImpl.Get().GetServer(typeof(ResourceTracker), instance
                                                                , addr, conf, null, 1);
                server.Start();
            }
            catch (YarnRuntimeException e)
            {
                Sharpen.Runtime.PrintStackTrace(e);
                NUnit.Framework.Assert.Fail("Failed to create server");
            }
            finally
            {
                server.Stop();
            }
        }