Search in sources :

Example 1 with NamespaceInfoProto

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

the class TestPBHelper method testConvertNamespaceInfo.

@Test
public void testConvertNamespaceInfo() {
    NamespaceInfo info = new NamespaceInfo(37, "clusterID", "bpID", 2300);
    NamespaceInfoProto proto = PBHelper.convert(info);
    NamespaceInfo info2 = PBHelper.convert(proto);
    //Compare the StorageInfo
    compare(info, info2);
    assertEquals(info.getBlockPoolID(), info2.getBlockPoolID());
    assertEquals(info.getBuildVersion(), info2.getBuildVersion());
}
Also used : NamespaceInfo(org.apache.hadoop.hdfs.server.protocol.NamespaceInfo) NamespaceInfoProto(org.apache.hadoop.hdfs.protocol.proto.HdfsServerProtos.NamespaceInfoProto) Test(org.junit.Test)

Example 2 with NamespaceInfoProto

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

the class PBHelper method convert.

public static NamespaceInfoProto convert(NamespaceInfo info) {
    NamespaceInfoProto.Builder builder = NamespaceInfoProto.newBuilder();
    builder.setBlockPoolID(info.getBlockPoolID()).setBuildVersion(info.getBuildVersion()).setUnused(0).setStorageInfo(PBHelper.convert((StorageInfo) info)).setSoftwareVersion(info.getSoftwareVersion()).setCapabilities(info.getCapabilities());
    HAServiceState state = info.getState();
    if (state != null) {
        builder.setState(convert(info.getState()));
    }
    return builder.build();
}
Also used : StorageInfo(org.apache.hadoop.hdfs.server.common.StorageInfo) HAServiceState(org.apache.hadoop.ha.HAServiceProtocol.HAServiceState) NamespaceInfoProto(org.apache.hadoop.hdfs.protocol.proto.HdfsServerProtos.NamespaceInfoProto)

Aggregations

NamespaceInfoProto (org.apache.hadoop.hdfs.protocol.proto.HdfsServerProtos.NamespaceInfoProto)2 HAServiceState (org.apache.hadoop.ha.HAServiceProtocol.HAServiceState)1 StorageInfo (org.apache.hadoop.hdfs.server.common.StorageInfo)1 NamespaceInfo (org.apache.hadoop.hdfs.server.protocol.NamespaceInfo)1 Test (org.junit.Test)1