Exemplo n.º 1
0
		/// <exception cref="System.IO.IOException"/>
		internal static Org.Apache.Hadoop.Security.Token.Token<JobTokenIdentifier> DeserializeServiceData
			(ByteBuffer secret)
		{
			DataInputByteBuffer @in = new DataInputByteBuffer();
			@in.Reset(secret);
			Org.Apache.Hadoop.Security.Token.Token<JobTokenIdentifier> jt = new Org.Apache.Hadoop.Security.Token.Token
				<JobTokenIdentifier>();
			jt.ReadFields(@in);
			return jt;
		}
Exemplo n.º 2
0
        /// <summary>Test token serialization</summary>
        /// <exception cref="System.IO.IOException"/>
        public virtual void TestTokenSerialization()
        {
            // Get a token
            Org.Apache.Hadoop.Security.Token.Token <TokenIdentifier> sourceToken = new Org.Apache.Hadoop.Security.Token.Token
                                                                                   <TokenIdentifier>();
            sourceToken.SetService(new Text("service"));
            // Write it to an output buffer
            DataOutputBuffer @out = new DataOutputBuffer();

            sourceToken.Write(@out);
            // Read the token back
            DataInputBuffer @in = new DataInputBuffer();

            @in.Reset(@out.GetData(), @out.GetLength());
            Org.Apache.Hadoop.Security.Token.Token <TokenIdentifier> destToken = new Org.Apache.Hadoop.Security.Token.Token
                                                                                 <TokenIdentifier>();
            destToken.ReadFields(@in);
            Assert.True(CheckEqual(sourceToken, destToken));
        }