private void TestPbServerFactory() { IPEndPoint addr = new IPEndPoint(0); Configuration conf = new Configuration(); LocalizationProtocol instance = new TestRPCFactories.LocalizationProtocolTestImpl (this); Org.Apache.Hadoop.Ipc.Server server = null; try { server = RpcServerFactoryPBImpl.Get().GetServer(typeof(LocalizationProtocol), instance , addr, conf, null, 1); server.Start(); } catch (YarnRuntimeException e) { Sharpen.Runtime.PrintStackTrace(e); NUnit.Framework.Assert.Fail("Failed to create server"); } finally { if (server != null) { server.Stop(); } } }
public static void Start() { IPEndPoint address = new IPEndPoint(0); Configuration configuration = new Configuration(); ResourceTracker instance = new TestResourceTrackerPBClientImpl.ResourceTrackerTestImpl (); server = RpcServerFactoryPBImpl.Get().GetServer(typeof(ResourceTracker), instance , address, configuration, null, 1); server.Start(); client = (ResourceTracker)RpcClientFactoryPBImpl.Get().GetClient(typeof(ResourceTracker ), 1, NetUtils.GetConnectAddress(server), configuration); }
private void TestPbClientFactory() { IPEndPoint addr = new IPEndPoint(0); System.Console.Error.WriteLine(addr.GetHostName() + addr.Port); Configuration conf = new Configuration(); ApplicationMasterProtocol instance = new TestRPCFactories.AMRMProtocolTestImpl(this ); Server server = null; try { server = RpcServerFactoryPBImpl.Get().GetServer(typeof(ApplicationMasterProtocol) , instance, addr, conf, null, 1); server.Start(); System.Console.Error.WriteLine(server.GetListenerAddress()); System.Console.Error.WriteLine(NetUtils.GetConnectAddress(server)); ApplicationMasterProtocol amrmClient = null; try { amrmClient = (ApplicationMasterProtocol)RpcClientFactoryPBImpl.Get().GetClient(typeof( ApplicationMasterProtocol), 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 { if (server != null) { server.Stop(); } } }
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(); } }