public void testFragmentTaskWithTwoFrags() throws IOException {
Object[] params1 = {10, 10.1};
Object[] params2 = {20, 20.2};
ParameterSet param_set1 = ParameterSet.fromArrayNoCopy(params1);
ParameterSet param_set2 = ParameterSet.fromArrayNoCopy(params2);
ByteBuffer param1_buf = ByteBuffer.allocate(param_set1.getSerializedSize());
param_set1.flattenToBuffer(param1_buf);
param1_buf.flip();
ByteBuffer param2_buf = ByteBuffer.allocate(param_set2.getSerializedSize());
param_set2.flattenToBuffer(param2_buf);
param2_buf.flip();
FragmentTaskMessage ft = new FragmentTaskMessage(9, 70654312, -75, 99, true, true, false);
ft.addFragment(new byte[20], 12, param1_buf);
ft.addFragment(new byte[20], 24, param2_buf);
ft.setFragmentTaskType(FragmentTaskMessage.SYS_PROC_PER_PARTITION);
FragmentTaskMessage ft2 = (FragmentTaskMessage) checkVoltMessage(ft);
assertEquals(ft.getInitiatorHSId(), ft2.getInitiatorHSId());
assertEquals(ft.getCoordinatorHSId(), ft2.getCoordinatorHSId());
assertEquals(ft.getTxnId(), ft2.getTxnId());
assertEquals(ft.getUniqueId(), ft2.getUniqueId());
assertEquals(ft.isReadOnly(), ft2.isReadOnly());
assertEquals(ft.isForReplay(), ft2.isForReplay());
assertEquals(ft.getFragmentCount(), ft2.getFragmentCount());
assertEquals(ft.isFinalTask(), ft2.isFinalTask());
assertEquals(ft.isSysProcTask(), ft2.isSysProcTask());
assertEquals(2, ft2.getFragmentCount());
ParameterSet params = null;
ByteBuffer paramData = ft2.getParameterDataForFragment(0);
if (paramData != null) {
params = ParameterSet.fromByteBuffer(paramData);
assertEquals(10, params.toArray()[0]);
assertEquals(10.1, params.toArray()[1]);
}
params = null;
paramData = ft2.getParameterDataForFragment(1);
if (paramData != null) {
params = ParameterSet.fromByteBuffer(paramData);
assertEquals(20, params.toArray()[0]);
assertEquals(20.2, params.toArray()[1]);
}
}