public void test_metric_cpu_num_uint16(){
  final IGangliaMetadataMessage decl=new GangliaMetadataMessage("bigdata10","cpu_num",false,GangliaMessageTypeEnum.UINT16,"cpu_num","CPUs",GangliaSlopeEnum.zero,1200,0,AbstractMetrics.getMap(IGangliaAttributes.GROUP_CPU,"CPU Count","Total number of CPUs"));
  assertEncodeDecode(null,decl);
  final IGangliaMetricMessage expected=new GangliaMetricMessage(GangliaMessageTypeEnum.UINT16,"bigdata10","cpu_num",false,"%hu",Integer.valueOf(4));
  final byte[] actualData=assertEncodeDecode(decl,expected);
  final byte[] expectedData=new byte[]{0,0,0,-127,0,0,0,9,98,105,103,100,97,116,97,49,48,0,0,0,0,0,0,7,99,112,117,95,110,117,109,0,0,0,0,0,0,0,0,3,37,104,117,0,0,0,0,4};
  if (!Arrays.equals(expectedData,actualData)) {
    fail("expect: " + Arrays.toString(expectedData) + ", actual="+ Arrays.toString(actualData));
  }
}

public void test_metric_cpu_num_uint16 ( ) { final IGangliaMetadataMessage decl = new GangliaMetadataMessage ( "bigdata10" , "cpu_num" , false , GangliaMessageTypeEnum . UINT16 , "cpu_num" , "CPUs" , GangliaSlopeEnum . zero , 1200 , 0 , AbstractMetrics . getMap ( IGangliaAttributes . GROUP_CPU , "CPU Count" , "Total number of CPUs" ) ) ; assertEncodeDecode ( null , decl ) ; final IGangliaMetricMessage expected = new GangliaMetricMessage ( GangliaMessageTypeEnum . UINT16 , "bigdata10" , "cpu_num" , false , "%hu" , Integer . valueOf ( 4 ) ) ; final byte [ ] actualData = assertEncodeDecode ( decl , expected ) ; final byte [ ] expectedData = new byte [ ] { 0 , 0 , 0 , - 127 , 0 , 0 , 0 , 9 , 98 , 105 , 103 , 100 , 97 , 116 , 97 , 49 , 48 , 0 , 0 , 0 , 0 , 0 , 0 , 7 , 99 , 112 , 117 , 95 , 110 , 117 , 109 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 3 , 37 , 104 , 117 , 0 , 0 , 0 , 0 , 4 } ; if ( ! Arrays . equals ( expectedData , actualData ) ) { fail ( "expect: " + Arrays . toString ( expectedData ) + ", actual=" + Arrays . toString ( actualData ) ) ; } }
unit test for a cpu_num message .
