19
19
import static org .junit .Assert .assertTrue ;
20
20
21
21
import com .google .common .collect .Lists ;
22
+ import java .util .Arrays ;
22
23
23
24
import org .jboss .netty .buffer .ChannelBuffer ;
24
25
import org .junit .Before ;
@@ -277,6 +278,16 @@ public void testChannelBufferFixedSizeWithInitialization() {
277
278
checkSerializeAndDeserialize (rawMessage );
278
279
}
279
280
281
+ @ Test
282
+ public void testChannelBufferFixedSizeWithIncompleteInitialization () {
283
+ topicDefinitionResourceProvider .add ("foo/foo" , "uint8[5] data" );
284
+ ChannelBuffer buffer = MessageBuffers .dynamicBuffer ();
285
+ buffer .writeBytes (new byte [] { 1 , 2 , 3 });
286
+ RawMessage rawMessage = messageFactory .newFromType ("foo/foo" );
287
+ rawMessage .setChannelBuffer ("data" , buffer );
288
+ checkSerializeAndDeserialize (rawMessage );
289
+ }
290
+
280
291
@ Test
281
292
public void testChannelBufferFixedSizeNoInitialization () {
282
293
topicDefinitionResourceProvider .add ("foo/foo" , "uint8[5] data" );
@@ -294,6 +305,14 @@ public void testInt32FixedSizeArrayWithInitialization() {
294
305
checkSerializeAndDeserialize (rawMessage );
295
306
}
296
307
308
+ @ Test
309
+ public void testInt32FixedSizeArrayWithIncompleteInitialization () {
310
+ topicDefinitionResourceProvider .add ("foo/foo" , "int32[5] data" );
311
+ RawMessage rawMessage = messageFactory .newFromType ("foo/foo" );
312
+ rawMessage .setInt32Array ("data" , new int [] { 1 , 2 , 3 });
313
+ checkSerializeAndDeserialize (rawMessage );
314
+ }
315
+
297
316
@ Test
298
317
public void testInt32FixedSizeArrayNoInitialization () {
299
318
topicDefinitionResourceProvider .add ("foo/foo" , "int32[5] data" );
@@ -308,11 +327,44 @@ public void testFloat64FixedSizeArrayWithInitialization() {
308
327
rawMessage .setFloat64Array ("data" , new double [] { 1 , 2 , 3 , 4 , 5 });
309
328
checkSerializeAndDeserialize (rawMessage );
310
329
}
330
+
331
+ @ Test
332
+ public void testFloat64FixedSizeArrayWithIncompleteInitialization () {
333
+ topicDefinitionResourceProvider .add ("foo/foo" , "float64[5] data" );
334
+ RawMessage rawMessage = messageFactory .newFromType ("foo/foo" );
335
+ rawMessage .setFloat64Array ("data" , new double [] { 1 , 2 , 3 });
336
+ checkSerializeAndDeserialize (rawMessage );
337
+ }
311
338
312
339
@ Test
313
340
public void testFloat64FixedSizeArrayNoInitialization () {
314
341
topicDefinitionResourceProvider .add ("foo/foo" , "float64[5] data" );
315
342
RawMessage rawMessage = messageFactory .newFromType ("foo/foo" );
316
343
checkSerializeAndDeserialize (rawMessage );
317
344
}
345
+
346
+ @ Test
347
+ public void testStringFixedSizeArrayWithInitialization () {
348
+ topicDefinitionResourceProvider .add ("foo/foo" , "string[5] data" );
349
+ RawMessage rawMessage = messageFactory .newFromType ("foo/foo" );
350
+ String [] stringArray = new String [] { "String 1" , "String 2" , "String 3" , "String 4" , "String 5" };
351
+ rawMessage .setStringList ("data" , Arrays .asList (stringArray ));
352
+ checkSerializeAndDeserialize (rawMessage );
353
+ }
354
+
355
+ @ Test
356
+ public void testStringFixedSizeArrayWithIncompleteInitialization () {
357
+ topicDefinitionResourceProvider .add ("foo/foo" , "string[5] data" );
358
+ RawMessage rawMessage = messageFactory .newFromType ("foo/foo" );
359
+ String [] stringArray = new String [] { "String 1" , "String 2" , "String 3" };
360
+ rawMessage .setStringList ("data" , Arrays .asList (stringArray ));
361
+ checkSerializeAndDeserialize (rawMessage );
362
+ }
363
+
364
+ @ Test
365
+ public void testStringFixedSizeArrayWithNoInitialization () {
366
+ topicDefinitionResourceProvider .add ("foo/foo" , "string[5] data" );
367
+ RawMessage rawMessage = messageFactory .newFromType ("foo/foo" );
368
+ checkSerializeAndDeserialize (rawMessage );
369
+ }
318
370
}
0 commit comments