Example #1
0
        public virtual void TestDecodePath()
        {
            string             EscapedPath  = "/test%25+1%26%3Dtest?op=OPEN&foo=bar";
            string             ExpectedPath = "/test%+1&=test";
            Configuration      conf         = new Configuration();
            QueryStringDecoder decoder      = new QueryStringDecoder(WebHdfsHandler.WebhdfsPrefix
                                                                     + EscapedPath);
            ParameterParser testParser = new ParameterParser(decoder, conf);

            NUnit.Framework.Assert.AreEqual(ExpectedPath, testParser.Path());
        }
Example #2
0
        /// <exception cref="System.Exception"/>
        protected override void ChannelRead0(ChannelHandlerContext ctx, HttpRequest req)
        {
            Preconditions.CheckArgument(req.GetUri().StartsWith(WebhdfsPrefix));
            QueryStringDecoder queryString = new QueryStringDecoder(req.GetUri());

            @params = new ParameterParser(queryString, conf);
            DataNodeUGIProvider ugiProvider = new DataNodeUGIProvider(@params);

            ugi  = ugiProvider.Ugi();
            path = @params.Path();
            InjectToken();
            ugi.DoAs(new _PrivilegedExceptionAction_110(this, ctx, req));
        }
Example #3
0
        public virtual void TestDeserializeHAToken()
        {
            Configuration conf = DFSTestUtil.NewHAConfiguration(LogicalName);

            Org.Apache.Hadoop.Security.Token.Token <DelegationTokenIdentifier> token = new Org.Apache.Hadoop.Security.Token.Token
                                                                                       <DelegationTokenIdentifier>();
            QueryStringDecoder decoder = new QueryStringDecoder(WebHdfsHandler.WebhdfsPrefix
                                                                + "/?" + NamenodeAddressParam.Name + "=" + LogicalName + "&" + DelegationParam.Name
                                                                + "=" + token.EncodeToUrlString());
            ParameterParser testParser = new ParameterParser(decoder, conf);

            Org.Apache.Hadoop.Security.Token.Token <DelegationTokenIdentifier> tok2 = testParser
                                                                                      .DelegationToken();
            NUnit.Framework.Assert.IsTrue(HAUtil.IsTokenForLogicalUri(tok2));
        }
 internal DataNodeUGIProvider(ParameterParser @params)
 {
     this.@params = @params;
 }