|
@@ -18,8 +18,12 @@
|
|
package org.apache.hadoop.hdfs.server.namenode;
|
|
package org.apache.hadoop.hdfs.server.namenode;
|
|
|
|
|
|
|
|
|
|
|
|
+import static org.mockito.Mockito.mock;
|
|
|
|
+
|
|
import java.io.IOException;
|
|
import java.io.IOException;
|
|
|
|
|
|
|
|
+import javax.servlet.http.HttpServletRequest;
|
|
|
|
+
|
|
import junit.framework.Assert;
|
|
import junit.framework.Assert;
|
|
|
|
|
|
import org.apache.hadoop.conf.Configuration;
|
|
import org.apache.hadoop.conf.Configuration;
|
|
@@ -32,10 +36,11 @@ import org.junit.Test;
|
|
public class TestNameNodeJspHelper {
|
|
public class TestNameNodeJspHelper {
|
|
|
|
|
|
private MiniDFSCluster cluster = null;
|
|
private MiniDFSCluster cluster = null;
|
|
|
|
+ Configuration conf = null;
|
|
|
|
|
|
@Before
|
|
@Before
|
|
public void setUp() throws Exception {
|
|
public void setUp() throws Exception {
|
|
- Configuration conf = new HdfsConfiguration();
|
|
|
|
|
|
+ conf = new HdfsConfiguration();
|
|
cluster = new MiniDFSCluster(conf, 1, true, null);
|
|
cluster = new MiniDFSCluster(conf, 1, true, null);
|
|
cluster.waitActive();
|
|
cluster.waitActive();
|
|
}
|
|
}
|
|
@@ -49,7 +54,9 @@ public class TestNameNodeJspHelper {
|
|
@Test
|
|
@Test
|
|
public void testDelegationToken() throws IOException, InterruptedException {
|
|
public void testDelegationToken() throws IOException, InterruptedException {
|
|
NameNode nn = cluster.getNameNode();
|
|
NameNode nn = cluster.getNameNode();
|
|
- String tokenString = NamenodeJspHelper.getDelegationToken(nn, "SomeUser");
|
|
|
|
|
|
+ HttpServletRequest request = mock(HttpServletRequest.class);
|
|
|
|
+ String tokenString = NamenodeJspHelper
|
|
|
|
+ .getDelegationToken(nn, request, conf);
|
|
//tokenString returned must be null because security is disabled
|
|
//tokenString returned must be null because security is disabled
|
|
Assert.assertEquals(null, tokenString);
|
|
Assert.assertEquals(null, tokenString);
|
|
}
|
|
}
|