}
@Test
public void testBroadcast() {
// Test for IntValue
@SuppressWarnings("unchecked")
final RecordComparator intComp = new RecordComparator(new int[] {0}, new Class[] {IntValue.class});
final ChannelSelector<Record> oe1 = new RecordOutputEmitter(ShipStrategyType.BROADCAST, intComp);
int numChannels = 100;
int numRecords = 50000;
int[] hit = new int[numChannels];
for (int i = 0; i < numRecords; i++) {
IntValue k = new IntValue(i);
Record rec = new Record(k);
int[] chans = oe1.selectChannels(rec, hit.length);
for(int j=0; j < chans.length; j++) {
hit[chans[j]]++;
}
}
for (int i = 0; i < hit.length; i++) {
assertTrue(hit[i]+"", hit[i] == numRecords);
}
// Test for StringValue
@SuppressWarnings("unchecked")
final RecordComparator stringComp = new RecordComparator(new int[] {0}, new Class[] {StringValue.class});
final ChannelSelector<Record> oe2 = new RecordOutputEmitter(ShipStrategyType.BROADCAST, stringComp);
numChannels = 100;
numRecords = 5000;