|
@@ -17,8 +17,11 @@
|
|
*/
|
|
*/
|
|
package org.apache.hadoop.hdfs.server.namenode;
|
|
package org.apache.hadoop.hdfs.server.namenode;
|
|
|
|
|
|
|
|
+import static org.apache.hadoop.hdfs.DFSConfigKeys.DFS_NAMENODE_CHECKPOINT_TXNS_KEY;
|
|
|
|
+
|
|
import org.apache.hadoop.conf.Configuration;
|
|
import org.apache.hadoop.conf.Configuration;
|
|
import org.apache.hadoop.hdfs.DFSConfigKeys;
|
|
import org.apache.hadoop.hdfs.DFSConfigKeys;
|
|
|
|
+import org.apache.hadoop.hdfs.DFSTestUtil;
|
|
import org.apache.hadoop.hdfs.MiniDFSCluster;
|
|
import org.apache.hadoop.hdfs.MiniDFSCluster;
|
|
import org.junit.AfterClass;
|
|
import org.junit.AfterClass;
|
|
import org.junit.Assert;
|
|
import org.junit.Assert;
|
|
@@ -28,6 +31,7 @@ import org.junit.Test;
|
|
import javax.management.*;
|
|
import javax.management.*;
|
|
import java.io.IOException;
|
|
import java.io.IOException;
|
|
import java.lang.management.ManagementFactory;
|
|
import java.lang.management.ManagementFactory;
|
|
|
|
+import java.net.URL;
|
|
|
|
|
|
public class TestSecondaryWebUi {
|
|
public class TestSecondaryWebUi {
|
|
|
|
|
|
@@ -39,6 +43,7 @@ public class TestSecondaryWebUi {
|
|
public static void setUpCluster() throws IOException {
|
|
public static void setUpCluster() throws IOException {
|
|
conf.set(DFSConfigKeys.DFS_NAMENODE_SECONDARY_HTTP_ADDRESS_KEY,
|
|
conf.set(DFSConfigKeys.DFS_NAMENODE_SECONDARY_HTTP_ADDRESS_KEY,
|
|
"0.0.0.0:0");
|
|
"0.0.0.0:0");
|
|
|
|
+ conf.setLong(DFS_NAMENODE_CHECKPOINT_TXNS_KEY, 500);
|
|
cluster = new MiniDFSCluster.Builder(conf).numDataNodes(0)
|
|
cluster = new MiniDFSCluster.Builder(conf).numDataNodes(0)
|
|
.build();
|
|
.build();
|
|
cluster.waitActive();
|
|
cluster.waitActive();
|
|
@@ -73,4 +78,18 @@ public class TestSecondaryWebUi {
|
|
Assert.assertArrayEquals(checkpointEditlogDir,
|
|
Assert.assertArrayEquals(checkpointEditlogDir,
|
|
snn.getCheckpointEditlogDirectories());
|
|
snn.getCheckpointEditlogDirectories());
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ @Test
|
|
|
|
+ public void testSecondaryWebUiJsp()
|
|
|
|
+ throws IOException, MalformedObjectNameException,
|
|
|
|
+ AttributeNotFoundException, MBeanException,
|
|
|
|
+ ReflectionException, InstanceNotFoundException {
|
|
|
|
+ String pageContents = DFSTestUtil.urlGet(new URL("http://localhost:" +
|
|
|
|
+ SecondaryNameNode.getHttpAddress(conf).getPort() + "/status.jsp"));
|
|
|
|
+ Assert.assertTrue("Didn't find \"Last Checkpoint\"",
|
|
|
|
+ pageContents.contains("Last Checkpoint"));
|
|
|
|
+ Assert.assertTrue("Didn't find Checkpoint Transactions: 500",
|
|
|
|
+ pageContents.contains("Checkpoint Transactions: 500"));
|
|
|
|
+
|
|
|
|
+ }
|
|
}
|
|
}
|