builder.setMeterId(new MeterId(2248L));
builder.setBands(createBandsList());
MeterModInput message = builder.build();
builder.setMeterId(new MeterId(2248L));
builder.setBands(createBandsList());
MeterModInput message = builder.build();
ByteBuf out = UnpooledByteBufAllocator.DEFAULT.buffer();
meterModFactory.serialize(message, out);
ByteBuf out = UnpooledByteBufAllocator.DEFAULT.buffer();
meterModFactory.serialize(message, out);
BufferHelper.checkHeaderV13(out, (byte) 29, 48);
Assert.assertEquals("Wrong meterModCommand", message.getCommand().getIntValue(), out.readUnsignedShort());
Assert.assertEquals("Wrong meterFlags", message.getFlags(), decodeMeterModFlags(out.readShort()));
Assert.assertEquals("Wrong meterId", message.getMeterId().getValue().intValue(), out.readUnsignedInt());
Assert.assertEquals("Wrong bands", message.getBands(), decodeBandsList(out));
}
BufferHelper.checkHeaderV13(out, (byte) 29, 48);
Assert.assertEquals("Wrong meterModCommand", message.getCommand().getIntValue(), out.readUnsignedShort());
Assert.assertEquals("Wrong meterFlags", message.getFlags(), decodeMeterModFlags(out.readShort()));
Assert.assertEquals("Wrong meterId", message.getMeterId().getValue().intValue(), out.readUnsignedInt());
Assert.assertEquals("Wrong bands", message.getBands(), decodeBandsList(out));
}
private static MeterFlags decodeMeterModFlags(short input){
final Boolean _oFPMFKBPS = (input & (1 << 0)) > 0;
final Boolean _oFPMFPKTPS = (input & (1 << 1)) > 0;
private static MeterFlags decodeMeterModFlags(short input){
final Boolean _oFPMFKBPS = (input & (1 << 0)) > 0;
final Boolean _oFPMFPKTPS = (input & (1 << 1)) > 0;
final Boolean _oFPMFSTATS = (input & (1 << 3)) > 0;
return new MeterFlags(_oFPMFBURST, _oFPMFKBPS, _oFPMFPKTPS, _oFPMFSTATS);
}
final Boolean _oFPMFSTATS = (input & (1 << 3)) > 0;
return new MeterFlags(_oFPMFBURST, _oFPMFKBPS, _oFPMFPKTPS, _oFPMFSTATS);
}
private static List<Bands> createBandsList(){
List<Bands> bandsList = new ArrayList<>();
BandsBuilder bandsBuilder = new BandsBuilder();
private static List<Bands> createBandsList(){
List<Bands> bandsList = new ArrayList<>();
BandsBuilder bandsBuilder = new BandsBuilder();
private static List<Bands> decodeBandsList(ByteBuf input){
List<Bands> bandsList = new ArrayList<>();
BandsBuilder bandsBuilder = new BandsBuilder();
private static List<Bands> decodeBandsList(ByteBuf input){
List<Bands> bandsList = new ArrayList<>();
BandsBuilder bandsBuilder = new BandsBuilder();
ByteBuf out = UnpooledByteBufAllocator.DEFAULT.buffer();
meterModFactory.serialize(message, out);
ByteBuf out = UnpooledByteBufAllocator.DEFAULT.buffer();
meterModFactory.serialize(message, out);
BufferHelper.checkHeaderV13(out, (byte) 29, 16);
Assert.assertEquals("Wrong meterModCommand", message.getCommand().getIntValue(), out.readUnsignedShort());
Assert.assertEquals("Wrong meterFlags", message.getFlags(), decodeMeterModFlags(out.readShort()));
BufferHelper.checkHeaderV13(out, (byte) 29, 16);
Assert.assertEquals("Wrong meterModCommand", message.getCommand().getIntValue(), out.readUnsignedShort());
Assert.assertEquals("Wrong meterFlags", message.getFlags(), decodeMeterModFlags(out.readShort()));