Search in sources :

Example 1 with NamenodeRegistrationProto

use of org.apache.hadoop.hdfs.protocol.proto.HdfsServerProtos.NamenodeRegistrationProto in project hadoop by apache.

the class TestPBHelper method testConvertNamenodeRegistration.

@Test
public void testConvertNamenodeRegistration() {
    StorageInfo info = getStorageInfo(NodeType.NAME_NODE);
    NamenodeRegistration reg = new NamenodeRegistration("address:999", "http:1000", info, NamenodeRole.NAMENODE);
    NamenodeRegistrationProto regProto = PBHelper.convert(reg);
    NamenodeRegistration reg2 = PBHelper.convert(regProto);
    assertEquals(reg.getAddress(), reg2.getAddress());
    assertEquals(reg.getClusterID(), reg2.getClusterID());
    assertEquals(reg.getCTime(), reg2.getCTime());
    assertEquals(reg.getHttpAddress(), reg2.getHttpAddress());
    assertEquals(reg.getLayoutVersion(), reg2.getLayoutVersion());
    assertEquals(reg.getNamespaceID(), reg2.getNamespaceID());
    assertEquals(reg.getRegistrationID(), reg2.getRegistrationID());
    assertEquals(reg.getRole(), reg2.getRole());
    assertEquals(reg.getVersion(), reg2.getVersion());
}
Also used : NamenodeRegistration(org.apache.hadoop.hdfs.server.protocol.NamenodeRegistration) NamenodeRegistrationProto(org.apache.hadoop.hdfs.protocol.proto.HdfsServerProtos.NamenodeRegistrationProto) StorageInfo(org.apache.hadoop.hdfs.server.common.StorageInfo) DatanodeStorageInfo(org.apache.hadoop.hdfs.server.blockmanagement.DatanodeStorageInfo) Test(org.junit.Test)

Aggregations

NamenodeRegistrationProto (org.apache.hadoop.hdfs.protocol.proto.HdfsServerProtos.NamenodeRegistrationProto)1 DatanodeStorageInfo (org.apache.hadoop.hdfs.server.blockmanagement.DatanodeStorageInfo)1 StorageInfo (org.apache.hadoop.hdfs.server.common.StorageInfo)1 NamenodeRegistration (org.apache.hadoop.hdfs.server.protocol.NamenodeRegistration)1 Test (org.junit.Test)1