1919import static org .junit .Assert .assertTrue ;
2020
2121import com .google .common .collect .Lists ;
22+ import java .util .Arrays ;
2223
2324import org .jboss .netty .buffer .ChannelBuffer ;
2425import org .junit .Before ;
@@ -277,6 +278,16 @@ public void testChannelBufferFixedSizeWithInitialization() {
277278 checkSerializeAndDeserialize (rawMessage );
278279 }
279280
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+
280291 @ Test
281292 public void testChannelBufferFixedSizeNoInitialization () {
282293 topicDefinitionResourceProvider .add ("foo/foo" , "uint8[5] data" );
@@ -294,6 +305,14 @@ public void testInt32FixedSizeArrayWithInitialization() {
294305 checkSerializeAndDeserialize (rawMessage );
295306 }
296307
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+
297316 @ Test
298317 public void testInt32FixedSizeArrayNoInitialization () {
299318 topicDefinitionResourceProvider .add ("foo/foo" , "int32[5] data" );
@@ -308,11 +327,44 @@ public void testFloat64FixedSizeArrayWithInitialization() {
308327 rawMessage .setFloat64Array ("data" , new double [] { 1 , 2 , 3 , 4 , 5 });
309328 checkSerializeAndDeserialize (rawMessage );
310329 }
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+ }
311338
312339 @ Test
313340 public void testFloat64FixedSizeArrayNoInitialization () {
314341 topicDefinitionResourceProvider .add ("foo/foo" , "float64[5] data" );
315342 RawMessage rawMessage = messageFactory .newFromType ("foo/foo" );
316343 checkSerializeAndDeserialize (rawMessage );
317344 }
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+ }
318370}
0 commit comments