Example #1
0
 /// <summary>Start RPC server</summary>
 /// <exception cref="System.IO.IOException"/>
 internal MiniServer(Configuration conf, string user, string keytabFile)
 {
     UserGroupInformation.SetConfiguration(conf);
     UserGroupInformation.LoginUserFromKeytab(user, keytabFile);
     secretManager = new TestDelegationToken.TestDelegationTokenSecretManager(24 * 60
                                                                              * 60 * 1000, 7 * 24 * 60 * 60 * 1000, 24 * 60 * 60 * 1000, 3600000);
     secretManager.StartThreads();
     rpcServer = new RPC.Builder(conf).SetProtocol(typeof(MiniRPCBenchmark.MiniProtocol
                                                          )).SetInstance(this).SetBindAddress(DefaultServerAddress).SetPort(0).SetNumHandlers
                     (1).SetVerbose(false).SetSecretManager(secretManager).Build();
     rpcServer.Start();
 }
Example #2
0
        /// <exception cref="System.IO.IOException"/>
        public virtual void TestDecodeIdentifier()
        {
            TestDelegationToken.TestDelegationTokenSecretManager secretManager = new TestDelegationToken.TestDelegationTokenSecretManager
                                                                                     (0, 0, 0, 0);
            secretManager.StartThreads();
            TestDelegationToken.TestDelegationTokenIdentifier id = new TestDelegationToken.TestDelegationTokenIdentifier
                                                                       (new Text("owner"), new Text("renewer"), new Text("realUser"));
            Org.Apache.Hadoop.Security.Token.Token <TestDelegationToken.TestDelegationTokenIdentifier
                                                    > token = new Org.Apache.Hadoop.Security.Token.Token <TestDelegationToken.TestDelegationTokenIdentifier
                                                                                                          >(id, secretManager);
            TokenIdentifier idCopy = token.DecodeIdentifier();

            NUnit.Framework.Assert.AreNotSame(id, idCopy);
            Assert.Equal(id, idCopy);
        }